You are on page 1of 18

Selenium - Training

Tool for Functional Testing for Web Applications

Presenter Saranya. BS (saranya.b@hcl.com)

Agenda

Introduction to Selenium Different Components of Selenium Choosing the right Selenium tool Selenium IDE Installation Record and Play back using Selenium IDE tool Selenium RC Installation TestNG framework setup Running Test suites in TestNG framework Report generation using TestNG

Introduction to Selenium
Selenium is an open source tool It is used for testing Web based applications It can run in most of the Browsers and Operating systems Highly flexible and user friendly tool Test scripts can be written in many programming languages (C,C++, Java, Python,.Net, etc.,)

Different Components of Selenium

Selenium IDE
A simple Firefox plugin to record and playback tests
It doesnt require programming knowledge

Selenium RC (Remote Control)


Used to run tests in different browsers

Selenium RC is a combination of selenium server and

any of the client libraries (E.g., Java, .Net, C,C++, etc)

Selenium Grid
Selenium Grid is used to run tests in parallel The tests that are run in parallel can be executed in

multiple browsers running in multiple systems running different OSes.

Choosing the right Selenium tool


Selenium IDE

Selenium RC/ Grid


This can be used for

IDE can be used for

creating advanced, simple record and playback of test scripts, modularized test where the code doesnt scripts(eg., for Data need huge driven test, for customizations including loops, for It does support customized test runs) customization of code like add/edit/remove but not Needs knowledge on programming loops languages like Java, This can be used even .Net, C, C++, etc. without any knowledge of programming languages

Selenium IDE Installation


Selenium IDE plugin can be downloaded from the below site http://seleniumhq.org/download/ Open Firefox and drag and drop the downloaded file into the browser Install the plugin and restart the browser The selenium IDE tool can be seen under the Tools menu in Firefox

Selenium IDE Components

Menu Bar
Can Create/Open Test cases and Test suites Test Cases could be exported to any language of our

choice from menu bar

Tool Bar
Play Test cases/ Test suite Control the speed of playing Test cases Pause and Replay the current running test case

Log/Reference/UI-Element/RollUp
The error messages and the information messages

could be seen under log at the bottom pane

Selenese Selenium commands


Eg., click, click and wait,Verifyelement Present,

Vertifytextpresent

Record and Playback using Selenium


Initialize selenium from the tools menu in Firefox Enter the URL of the application you want to test in Firefox Do the test case manually using mouse and keyboard All the actions performed will be recorded by selenium plugin Once the test case is complete, stop the recording from selenium toolbar and save it as a test case by giving it a unique name. we can run these recorded test cases later during regression analysis in every intermediate releases.

Building Test Cases


Recording Actions on the website will get added automatically as commands Adding Check points We can add assertions/verification points to check the properties Editing We can add/edit/delete commands from the Source View or Table View

Selenium RC Components
Selenium RC (Remote Control) is a combination of Selenium Server along with Client Libraries The Client Libraries could be any one of the following

Java .Net

Python
Ruby

Selenium RC Architecture

Selenium RC Installation with Java Client

Selenium Server
Download Selenium server file
(selenium-server-standalone-<version-

number>.jar)

Java Client Library


Download the Java Client driver Zip and extract

the same in a location Both the files could be downloaded from the following location http://seleniumhq.org/download/ Configure the Library files into the Java IDE(Eclipse, NetBeans,etc.,)

Frameworks Used in Selenium

Selenium RC with Java client libraries are used in majority with following two Frameworks.
JUnit Framework TestNG Framework

TestNG has the following advantages over JUnit


Support for Annotations Log Report Parameterisation

TestNG Framework SetUp


TestNG is a java plug-in for Eclipse TestNG could be downloaded from Eclipse by going to Help > Install New Software Type the following URL against Work with option http://beust.com/eclipse and continue with installation Once installation gets completed, the same can be seen under Windows Menu >> Show View >> Others >> Java >> TestNG(Shortcut: Alt+Shift+Q Q)

Running Test Suites in TestNG Framework


Create a Java Project Create an annotation class and write the test suite for testing the website Include all the external jar files to connect to the selenium server Right click on the project and run the test as TestNG

Report Generation using TestNG


All the reports will be present in testoutput folder An Email-able report will be available We can get the number of methods/suites passed or failed The time taken for running each tests could also be found the in the log report

? Questions

Thank You All !!!

You might also like