Wednesday, November 13, 2013

0 Selenium History

Sources:

The goal of this tutorial is to explain what comprises and defines Selenium. For this we need to look at some of its history and its architecture too. In fact its history is nothing but understanding how it has evolved (architecture) with time and who helped it in its evolution. To be frank with you, to be a Selenium developer it is enough to go through current Selenium WebDriver 2.0 API but we would cover this anyway in our tutorials because we want to pay respect to super heroes who created this awesome tool for us to help in automation and their story be told.

Selenium originally created by Jason Huggins in 2004. Along with contributions from ThoughtWorks engineers and others who are interested in this technology, he released it as an open source under Apache 2.0 license.

Selenium in general is a suite of 3 tools: Selenium IDE, Selenium WebDriver and finally Selenium Grid.

Selenium Core and Selenium IDE

Jason Huggins started Selenium project in 2004 while working at ThoughtWorks on one of their in-house application “Time and Expenses” system.  He wrote Selenium core in JavaScript.  Most of the browsers support JavaScript so this worked as a miracle and he was able to automate testing of his application on almost all browsers. Knowing this, his work was much appreciated and the word is spread about his work.

Using Selenium core automation was pretty easy to learn even for a non-programmer because it followed a table like syntax. This table operates over the raw Java Script. This table based approach is also called as keyword based approach.

Below we have given an example for Keyword or tabled based programming





Column 1 – ‘type’ is the command (the keyword for expected operation)
Column 2 – ‘//div[@id=’welcome text’] ‘ is the element identifier
Column 3 – ‘Howdy!!’ is an optional value.

So a user has to remember a bunch of keywords and pass the element locator to perform some action (automated), that's it. This keyword based approach became popular as Selenese.

This seems to pretty easy right? But developers and users of Selenium Core found problems in this design; they realized that maintaining a project even of an average size is difficult. Below are some of those problems,
  • Since selenium core is purely written in Selenium, it forced the developers with no option than hosting Selenium Core and tests on server. This is to avoid breaking browser’s security.
  • Giving access to server to host their test is not practical in real time.

In 2006, Shinya Kasatani of Japan became interested in Selenium, and using Firefox extension, he developed a complete integrated development environment-IDE, that’s where the name Selenium IDE originated from. It is a wrapper around Selenium core and using this tool one could record, edit and debug tests.
Please find Selenium IDE tutorials àhereß

Selenium RC – Remote control

A Selenium Remote Control is a server, written in Java, which accepts command for the browser via HTTP. This made it possible to write automation for a web application in any programming language that is capable of doing an http request.  This means you would write automation in your favorite programming language and kick of an automation run remotely. This is how Selenium RC – Remote Control got it's name. Note Selenium RC still uses table/keyword based approach internally. Http proxy internally converts these http requests into appropriate Selenese commands.

WebDriver
Yes, I did not call it Selenium-WebDriver. There is a reason for it. WebDriver is not a part of Selenium initially. WebDriver is another automation framework being developed at the same time frame where Selenium-RC was taking shape. This was developed with intention that tests should be independent of underlying technology. In case of Selenium RC this is not the case. They are dependent on JavaScript support for browser.  To eliminate this dependency Selenium WebDriver was developed to make use of browser native language.

Differences between Selenium RC and WebDriver
Selenium RC
WebDriver
Uses Selenium Core which makes extensive use of JavaScript
Communicates with a browser using browser native language.
Keyword based API
Object based API
Supports wide range of languages. Thanks to the idea of http requests.
Supports only Java
Need a server to run the test.
We don’t need a server her.

Selenium WebDriver

Selenium WebDriver = Selenium (RC) + WebDriver. 

Yes you guessed it right; Selenium WebDriver came into existence after mixing two different projects. In 2009, an announcement was made that Selenium RC and WebDriver would merge which eventually called as Selenium WebDriver. This implementation is done by using a browser specific browser-driver. Server is no long required here.

Selenium WebDriver is also known as Selenium 2.0 while Selenium RC is known as Selenium 1.0
Selenium 1.0 provides rich set of API calls for different browsers. On the other hand Selenium 2.0 aims at providing building blocks on which developers can create their own implementation. Consider Selenium 2.0 as a specification which is followed by developers of Selenium drivers. One such project is Watir-WebDriver in ruby, which implements the Watir API as a wrapper for Selenium-WebDriver  in ruby.




0 comments:

Post a Comment

 

QuestionSelenium Copyright @Shiva Krishna