Thursday, September 4, 2014

Introduction to Selenium

What is Selenium...?

  • Selenium is an open source (free) automated testing tool ( Suite of softwares : APIs/Plugin..etc) for web applications across different browsers and platforms. It is quite similar to HP Quick Test Pro (QTP) only that Selenium focuses on automating web-based applications.
    • Runs in many Browsers :
      • IE
      • Firefox
      • Chrome
      • Safari
              And Many Operating Systems :
      • Windows
      • Apple OS X 
      • Linux

    • Can be controlled by many Programming Languages  and Testing Frameworks like :
      • Java - Framework :  JUnit, TestNG
      • C# - Framework : NUnit
      • Python - Framework : unittest, pyunit, robot framework
      • JavaScript
      • Objective-C
      • Perl
      • PHP
      • Ruby
    • Programming languages are supported through Selenium Remote Control "drivers." These are libraries made for each language that expose commands from the Selenium API natively in the form of methods/functions.

  What are the Components of Selenium ?

Selenium Components
  • Selenium is not just a single tool but a suite of softwares (APIs/Plugins), each catering to different testing needs of an organization. 
  • Selenium has four components :
    • Selenium Integrated Development Environment (IDE/SIDE)
    • Selenium Remote Control (RC)
    • WebDriver
    • Selenium Grid

Who developed Selenium ?
Key persons who made the contributions for the Selenium Project :
    Jason Huggins
    • Primarily, Selenium was created by Jason Huggins in 2004. An engineer at ThoughtWorks, was working on a web application that required frequent testing. Having realized that the repetitious manual testing of their application was becoming more and more inefficient, he created a JavaScript program that would automatically control the browser's actions. He named this program as the JavaScriptTestRunner.
    • Seeing potential in this idea to help automate other web applications , he made JavaScriptRunner open-source which was later re-named as Selenium Core.

  • Why Selenium RC, NOT Selenium Core :
    • Because of The Same Origin Policy Issue :

    • Same Origin policy prohibits JavaScript code from accessing elements from a domain that is different from where it was launched. Example, the HTML code in www.google.com uses a JavaScript program 'randomScript.js'. The same origin policy will only allow randomScript.js to access pages within google.com such as google.com/mail, google.com/login, or google.com/signup. However, it cannot access pages from different sites such as yahoo.com/search, because they belong to different domains.
    • This is the reason why prior to Selenium RC, testers needed to install local copies of both Selenium Core (a JavaScript program) and the web server containing the web application being tested so they would belong to the same domain.
    • Selenium RC :

      • Paul Hammant ThoughtWork's Engineer  created  a server that will act as an HTTP proxy   to trick  the browser into believing that Selenium  Core  and the web application being tested come  from  the same domain. This system became  known  as the Selenium Remote Control or Selenium 1.

  • Birth of Selenium Grid :
  • Patrick Lightbody
    • Patrick Lightbody developed Selenium Grid to address the need of minimizing test execution times as much as possible. He initially called the system 'Hosted QA'. It was capable of capturing browser screenshots during significant stages, and also of sending out Selenium commands to different machines simultaneously.
  • Birth of Selenium IDE :
  • Shinya Kasatani
    • Shinya Kasatani of Japan created Selenium IDE in 2006, a Firefox extension that can automate the browser through a record-and-playback feature. He came up with this idea to further increase the speed in creating test cases.

  • Birth of WebDriver :
      Simon Stewart
    • Simon Stewart created WebDriver in 2006, when browsers and web applications were becoming more powerful and more restrictive with JavaScript programs like Selenium Core. It was the first cross-platform testing framework that could control the browser from the OS level.
  • Birth of Selenium 2 :
    • In 2008, the whole Selenium Team decided to merge WebDriver and Selenium RC to form a more powerful tool called Selenium 2, with WebDriver being the core. Currently, Selenium RC is still being developed but only in maintenance mode. Most of the Selenium Project's efforts are now focused on Selenium 2.





  • No comments:

    Post a Comment