PAGE-2 : SELENIUM COMPONENTS



BRIEF HISTORY OF SELENIUM

Selenium first came to life in 2004 when Jason Huggins was testing an internal application at Thought Works. Being a smart guy, he realized there were better uses of his time than manually stepping through the same tests with every change he made. He developed a JavaScript library that could drive interactions with the page, allowing him to automatically rerun tests against multiple browsers.
That library eventually became Selenium Core, which underlies all the functionality of Selenium Remote Control (RC) and Selenium IDE. Selenium RC was ground-breaking because no other product allowed you to control a browser from a language of your choice.

In 2006 a plucky engineer at Google named Simon Stewart started work on a project he called WebDriver. Google had long been a heavy user of Selenium, but testers had to work around the limitations of the product. Simon wanted a testing tool that spoke directly to the browser using the ‘native’ method for the browser and operating system, thus avoiding the restrictions of a sand boxed JavaScript environment. The WebDriver project began with the aim to solve the Selenium’ pain-points.

SELENIUM COMPONENTS
So what are the components in selenium to automate applications?
Selenium has 4 components:
  1. Selenium IDE
  2. Selenium RC
  3. Selenium Web driver
  4. Selenium Grid.

WHAT IS IDE 
The main purpose of IDE Is to record and run the scripts.
Here also the same kind of actions. Record by selenium IDE means our test cases we want to automate will be recorded .Whatever our test cases example Login, create campaign ,send transactions all these can be recorded via selenium IDE. After that i can execute it.

WHERE ARE YOU GOING TO RECORD THE TEST CASES :
Selenium IDE is an add on for FF .Means you can download and install selenium IDE in FF browser . Means this is for FF browsers only. 

Once the execution is completed you can re execute the test cases to retest . Its accountable for user actions only. Means whatever actions user is doing its accountable for that itself .

Bring some value in the test box,click some button etc. All these actions will be recorded and will generate some script. Initially the generated script will be in HTML language, if required we can convert the recorded script to other supported language as well.

NOTE : Recorded script can be executed on Selenium RC and Web driver as well.

SELENIUM RC: (RC-> Remote Control)
The main purpose of selenium RC is,it is a server. What server will do. It is responsible to serve the request.
You first need to launch a separate application called Selenium Remote Control (RC) Server before you can start testing.
The Selenium RC Server acts as a "middleman" between your Selenium commands and your browser.
When you begin testing, Selenium RC Server "injects" a JavaScript program called Selenium Core into the browser.
Once injected, Selenium Core will start receiving instructions relayed by the RC Server from your test program.
When the instructions are received, Selenium Core will execute them as Javascript commands.
The browser will obey the instructions of Selenium Core, and will relay its response to the RC Server.

The RC Server will receive the response of the browser and then display the results to you.
RC Server will fetch the next instruction from your test script to repeat the whole cycle.






WHAT IS AN API  
Simple it’s a mediator.
Suppose i am having a google search and i have typed something and clicked on to the search button.
So it will give you some search results. Google search acts as a mediator between your typed text in google and searched results.RC acts as a mediator between your application and scripts .


SELENIUM WEB DRIVER
WebDriver is a web automation framework that allows you to execute your tests against different browsers, not just Firefox (unlike Selenium IDE).
WebDriver also enables you to use a programming language in creating your test scripts (not possible in Selenium IDE).
You can now use conditional operations like if-then-else or switch-case .You can also perform looping like do-while.


In taxi driving, there are typically 3 actors:
  • the client; he tells the taxi driver where he wants to go and how to get there
  • the taxi driver; he executes the client's requests; the taxi driver sends his own requests to the car
  • the car; the car executes the taxi driver's requests
The client gets to the destination through dialogues that happen between the client - taxi driver and taxi driver - car.
In test automation with Selenium WebDriver (and other tools), there are 3 actors as well:
  • test engineer that writes the automation code; the automation code sends requests to the browser driver component
  • the browser driver component; it executes the test engineer requests; it sends its own request to the browser
  • the browser; it executes the browser driver requests
So this is the analogy:
  1. the test engineer is like a taxi client
  1. the browser driver is like a taxi driver
  1. the browser is like a taxi
The technical explanation is not using analogies.
Like most technical explanations, there are no photos either :(
When the automation script is executed, the following steps happen:
  • for each Selenium command, a HTTP request is created and sent to the browser driver
  • the browser driver uses a HTTP server for getting the HTTP requests
  • the HTTP server determines the steps needed for implementing the Selenium command
  • the implementation steps are executed on the browser
  • the execution status is sent back to the HTTP server

  • the HTTP server sends the status back to the automation script


FOLLOWING PROGRAMMING LANGUAGE ARE SUPPORTED BY SELENIUM WEB DRIVER 
C# , Haskell , Java,Perl, PHP ,Python , Ruby , JavaScript


SELENIUM GRID
Suppose i have automated my application via Web driver on IE browser about 100 scripts ,Then FF and then chrome also.
For example for each browser its taking 2 hrs. time. So my plan is to execute each test cases on multiple browsers .So how much time will it take ?? 6 hrs time. 

If i use grid ,we can execute all our scripts paralleled in all the targeted browsers at a Time . Advantage is we can save the execution time.
In Selenium grid there are hub and nodes.
    A hub is a central point from where your tests will be kicked off. There will only be one hub in a grid and it's launched from one system. The hub will connect one or more nodes that tests will be delegated to.

    Nodes are different Selenium instances that will execute tests on individual computer systems. There can be many nodes in a grid. The machines which are nodes need not be the same platform or have the same browser selection as that of the hub or the other nodes. A node on Windows might have the capability of offering Internet Explorer as a browser option, whereas this wouldn't be possible on Linux or Mac.


ID
Selenium IDE
Selenium RC
Selenium Webdriver
1
Mozilla Firefox Addon
Works on almost all the browsers except latest version
Works on almost all the versions of browser Chrome,Safari,Firefox,Opera
2
Record and Run Play Tool
No Record and Run
No Record and Run
3
No Server is required to start
Server is required to start
No server is required to start
4
Very Simple to use
Its simple and small API
Complex and bit larger API
5
Not at all Object Oriented
Less Object Oriented
Purely Object Oriented
6
Cannot move mouse cursor
Cannot move mouse cursor
Can Move Mouse Cursor
7
Cannot test Iphone/Andriois Application
Cannot test Iphone/Andrioid Application
Can Test Iphone /Andrioid Application



No comments:

About Me

My photo
Pune, Maharastra, India
You can reach me out at : jimmiamrit@gmail.com