Chrisrod's Weblog

febrero 16, 2010


Filed under: Selenium Test — chrisrod @ 11:09 pm


 01.                       What is selenium?


Selenium is a set of tools that is used to automate web application testing, across many platforms.


Between the biggest advantages of Selenium, we can mention:

          Runs in many browsers.

          Can be controlled with programming language like Java or PHP, that makes selenium very handy to integrate it to unit tests.

Selenium is usually used to have test cases that need to be run frequently,  with unlimited iterations and at the same time through this is possible to have a disciplined test documentation.

02.                       Components


2.1 Selenium IDE

               Selenium IDE is a Firefox Add on, that can be easily download from this site:

               This tool is integrated with Firefox and the way to use it is very easy and friendly to use.   Selenium IDE works like a recorder, recording all the actions that one has on a specific website, like clicks, data typed in a form,  making it possible to reproduce all steps took, and by this way create a test suite, that can be easily run with this handy tool.


Another great feature of this IDE, is that one can have a well structured explanation of all the possible commands that can be recorded or executed by Selenium IDE. Talking about the commands, with Selenium IDE is possible to have assertion or verifications when they are needed, set some delays, wait a determined time to a page to load, etc, etc.


If there is a disadvantage on using Selenium IDE, is that all the test cases have to be recorded on Firefox.


Getting into the programming world, Selenium IDE make possible to export all the commands that were set or recorded to one or all these programming languages:

          Java (JUnit or TestNG)

          Groovie (JUnit)







Figure 01. Selenium IDE



2.2 Selenium RC.

               Selenium Remote Control, gives Selenium all the flexibility that just a programming language can offer, making possible the development of test cases well structured, with programming logic (like iterations, control flow, etc), that at the end

 means a real automation of a suit of testing cases on an automated build environment.


2.3 Selenium Grid.

               Selenium Grid is on my opinion, one of the most interesting technologies in the field of web application testing, because apart of the fact of flexibility that Selenium RC offer to the testing cases, with Selenium Grid, is possible to run as many tests as we want  in a parallel way, relying on the HW capabilities or number of computers available to run the test cases.


With the help of Selenium Grid, one can run test cases in different browsers at the same time, on different operating systems, and by this way, having at the end a report that tells how the web application is behaving with all the test cases that run on it.



03.                       Selenium RC


3.1. What is Selenium RC?


As was mentioned previously, Selenium RC allow the creation of more complex test cases, because now is possible to rely on all the facilities that a programming language can offer, like querying to a Data Base, reading files, sending e-mails, etc.

Is important to mention that Selenium RC is composed by these components:

          Selenium Server

          Selenium Core

          Client Libraries


 Selenium Server.

        The Selenium Server is the hearth of Selenium RC, because is on this place, where all the commands sent by the programming language and all the messages answered by the web browser, are processed, interpreted and sent to the corresponding party.

Other functions that take place in the Selenium Server, is launching and closing the web browser, as mentioned at the previous paragraph, running the Selenese Commands to be executed in the browser through the injection of Selenium Core in the browser, HTTP proxy from which all the HTTP messages pass.

The way Selenium Server accomplish all these tasks, is basically because Selenium Server works relying on GET/POST request, that makes possible to any programming language to send request to the Selenium Server.

 Selenium Core.

As was mentioned previously, Selenium Core is a chunk of JavaScript functions that interpret and run Selenese Commands in the browser where the test is executed.

Selenium Core resides into the Selenium  Server and when this opens the Web Browser, the Selenium Core is injected in it and by this way any Selenese Command can be executed in the browser.

Client Libraries.

The client libraries are the interface between the Selenium Server and a Programming language. For the very same reason Selenium provides many methods to interact with the Web Browser, there is even a method to execute JS commands directly in the browser.

SeleniumRC Squema 

Figure 02. Selenium RC

04.                       Selenium Grid

4.1 What is Selenium Grid?

Selenium Grid is the best thing that Selenium could ever develop (so far), and I say this because with Selenium Grid, as mentioned before, is possible to run test cases in a parallel way in one or many computers, and not just that, because is possible to run on different operate systems, different browsers, and all at the same time, fantastic, isn’t it?

The components of Selenium Grid, are:

          Selenium Hub

          Selenium RCs

Selenium Hub.

Basically the functions of the Selenium Hub are the functions of a network switch, because all the test cases are now addressed to the hub instead of the RC and  this hub allocates all the test cases on every RC that is connected to it.  This means that the main function of the Selenium Hub is redirect all the Selenese commands sent by the Test Cases, to the corresponding RC and at the same time keep track of the testing sessions.

To make possible to Selenium work on this way, it is necessary to implement test cases that have to be executed in a parallel mode. Talking about JUnit, there is an extra library called “Parallel JUnit”, and through this library is possible to execute more than one test case at the same time. The other possibility, that I personally recommend, is using TestNG that is a testing framework inspired in JUnit, and for this reason the logic of creating testing cases is basically the same, TestNG also includes many annotations to its framework, that make the life easier when creating test cases. To mention other advantages of TestNG, we can say that:

          TestNG has a configuration file (testing.xml) that makes possible to configure the way that we want to run the test cases, and between these possibilities, running test cases in parallel.

          TestNG has support of parameters.

          TestNG has an Eclipse plug-in.

           TestNG makes possible to classify test cases by groups and by this way control the order and priority of the execution of the test cases.

 Selenium Grid Setup

Figure 03. Selenium Grid

05.                       Conclusions


Selenium is a powerful tool that can be used in many ways, but is particularly interesting the way that Selenium can be used to run and automate test cases, what makes possible to have testing cases that can be executed periodically and with this to have at the same time a good documentation of all the test cases that were created for a web application.


With the use of Selenium RC and Selenium Grid, the automation and running of test cases takes a different perspective, making possible to have a very detailed coverage of all the possibilities available in a web application, reviewing as well the behavior of it on different Operating Systems and Web Browsers especially when cross browser compatibility is a must.


Deja un comentario »

No hay comentarios aún.

RSS feed for comments on this post. TrackBack URI

Deja una respuesta

Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de

Estás comentando usando tu cuenta de Salir /  Cambiar )

Google photo

Estás comentando usando tu cuenta de Google. Salir /  Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Salir /  Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Salir /  Cambiar )

Conectando a %s

Crea un blog o un sitio web gratuitos con

A %d blogueros les gusta esto: