Thursday, April 24, 2014

They say "How about the architectural difference between Selenium versions"

I have seen many people asking a repetitive question in interviews if they see Selenium written on any Curriculum Vitae of a Test Engineer. Though I believe theoretical and conceptual knowledge is equally important as hand-on experience. As a part of hiring panel I have observed this as a pet question of our hiring team : 'How about the architectural difference between Selenium versions.' Of-course , once they are done with questions like 'What you know all about selenium' ?
Selenium generally comes in four different flavours :
Selenium IDE , Selenium RC , Selenium Grid and Selenium Webdriver.
I will be sharing the best answer I got and the research which I did so as to understand the architecture of selenium.

Selenium Remote Control:
Selenium RC or Selenium 1 is the first version of Selenium which is equally efficient as Selenium Webdriver. But there is a difference in architecture which both has. Along with a fact that selenium RC requires a server jar start-up every-time user wants to execute test cases/suite. This is just a one time effort which is required only in selenium RC , unlike Selenium Webdriver.

Selenium RC works on the principle of client - server . The client sends the request ( in Programming languages like Java , Python ,etc ) to the Server . The requests are in the form of commands like click , select , wait , etc.

And here Server takes the responsibility of granting the request to the Web browser. As we know Selenium is a Web Automation tool so the job will complete only when browser is able to respond on the requests which client is asking for.
At browser the Selenium core is residing which actually performs Java Script injections and hence-forth requests get executed.

RC-Selenium.PNG


Selenium Webdriver:

There are some differences which user can observe while working with Selenium Webdriver or if user is switching from Selenium RC to Selenium Webdriver.
First of all , it does not need any over-head like server start up etc.
If we talk about architecture then the major difference is Selenium Webdriver API is responsible for storing all commands and conversion of the commands in JSON format. The flow is Client sends the request in a Programming language and sends the command to the selenium Webdriver. This request is then send to the Selenium API where-in Selenium API restores the commands in the JSON format and send the request from the JSon format to the http, RESTful service. This conversion happens on the browser level where-in all the commands will work. Commands like select , click , etc which will be placed in the test suite and test case.


Webdriver-Selenium.PNG

Selenium Grid:
Selenium Grid is used majorly when user wants to run test cases parallely at the same time on same browser or on different browsers .

Here , There would be a selenium grid -hub where selenium server needs to be running and up all the time. All other machines which connects this machine will work as a client as this hub will work as a server to all the clients. Client will send the request to the server - hub and hub is responsible to cater all requests and respond on the all requests which are coming from the clients.




Happy testing ! :)

No comments:

Post a Comment