Sunday, September 18, 2016

Introduction to Selenium

Selenium is a free open source automated testing suite for website and web application across multiple browsers and platforms. Selenium is composed of multiple software tools. It has four components. Each has a specific role. 
  •     Selenium IDE (Integrated Development Environment)
  •     Selenium RC (Remote Control)
  •     Selenium WebDriver
  •     Selenium Grid  
Selenium RC and WebDriver are merged into a single framework to form Selenium 2. On the other hand, Selenium 1 refers to Selenium RC.











Detail about Selenium IDE (Integrated Development Environment)

Selenium IDE is the simplest framework in the Selenium suite. It is a Firefox extension which can automate the browser through a record-and-playback feature. It can be considered as a prototyping tool.
A Japanese named Shinya Kasatani created Selenium IDE. Selenium IDE was used first to the Selenium Project in 2006.

Advantages:

- Installation process is very easy.
- Only HTML and DOM knowledge are enough, on programming experience is required.
- Test script written in Selenium IDE can be exported to Selenium RC and Selenium WebDriver formats.
- Built-in-help and test results reporting module are available.
- Provide support for extensions.

Demerits

- Only support firefox browser.
- Doesn’t support for iteration and conditional operations
- Test execution is slow compared to Selenium RC and Selenium WebDriver.

Detail about Selenium RC (Remote Control)

Selenium Remote Control (RC) is a testing framework tool that allows writing automated web application UI tests in any programming language against any HTTP website using any mainstream JavaScript-enabled browser. This is the first automated web testing tool that allows user to use programming language.

A British citizen named Paul Hammant created Selenium RC.
Selenium RC components are:

  • The Selenium Server which launches and kills browsers, interprets and runs the Selenese commands passed from the test program, and acts as an HTTP proxy, intercepting and verifying HTTP messages passed between the browser and the AUT. 
  • Client libraries which provide the interface between each programming language and the Selenium RC Server.
Selenium RC supports the following browsers.
Java
C#
PHP
Perl
Python
    Ruby
    Advantages:
    - Support Cross-browser and cross-platform
    - Can readily support new browser
    - Can perform looping and conditional operations
    - Support data-driven testing
    - Has matured and complete API
    - Faster execution than IDE
    Demerits
    - Installation process is more complicated than IDE
    - Needs programming knowledge
    - Inconsistent results and uses JavaScript
    - Needs Selenium RC server to be running
    - API contains redundant and confusing commands
    - Browser interaction is less realistic
    - Slower execution time than WebDriver

    Detail about Selenium WebDriver


    Selenium WebDriver is a compact Object Oriented API that drives the browser more effectively to overcome the limitations of Selenium 1.x which affected our functional test coverage, like the file upload or download, pop-ups and dialogs barrier. It refers to both the language bindings and the implementations of the individual browser controlling code. Selenium-WebDriver makes direct calls to the browser using each browser’s native support for automation. 

    Simon Stewart created WebDriver circa in 2006.

    Selenium WebDriver interface implements the following classes.ChromeDriver, EventFiringWebDriver, FirefoxDriver, HtmlUnitDriver, InternetExplorerDriver, PhantomJSDriver, RemoteWebDriver, SafariDriver

    Selenium WebDriver supports the following programming languages.
            Java
              C#
                PHP
                  Perl
                    Python
                      Ruby
                Advantages:
                - Direct Communication to the browser
                - Simpler Installation than Selenium RC
                - Browser interaction is more realistic
                - No need for separate component like RC server
                - Faster execution time than Selenium IDE and Selenium RC


                Demerits:
                - More complicated installation than Selenium IDE
                - Need to have programming knowledge
                - Can not readily support new browsers
                - Has no built-in mechanism for logging runtime messages and generating test results


                Detail about Selenium Grid


                Selenium Grid is a tool that allows to test on different machines against different browsers in parallel. Parallel execution means running multiple tests at once.

                Features:
                 - Enables simultaneous running of tests in multiple browsers and environments.
                 - Saves time enormously.
                 - A grid consists of a single hub, and one or more nodes. The hub acts as a central source of Selenium commands to each node connected to it.