Selenium Introduction.
Selenium is a open source ( Free !!! ) tool for function/regression, unit testing the web application. It has a IDE which is actually a firefox add-ons which lets you record/playback the events and it also lets you export your test cases into the other desired ( Java, php, .net, ruby ) language for further editing.
It has three main component provided by selenium and other optional provided by third party.
- Selenium IDE: Require to record/playback the testcase and to export it in other language
- Selenium Core: Central control
- Selenium RC: Allows you to run your test cases from any other languages on other browsers (like IE, Opera ) and on other platforms ( Mac, Windows )
- Junit/Nunit: Junit is framework if you choose java to write the testcases and Nunit is if you choose to write down the testcases in .Net
- ANT: This is the reporting tool.
Installation:
Now to install and setup the selenium is bit tedious task. You need to download the following things:
- Selenium IDE
- Selenium Core
- Selenium RC
- Junit4.6
- JDK ( 1.5 or higer )
- Selenium IDE will be installed automatically if you have use firefox to download it else a .xpi file would have been downloaded. Just drad and drop the file on the firefox and it will be installed.
- Extract the Selenium Core, Selenium RC and Junit in your desired directory.
- install the JDK
- Find the out the "selenium-java-client-driver.jar" from the Selenium RC folder and set its full path as classpath as below
set path=%classpath%;full path of ""selenium-java-client-driver.jar" - Find out the Junit-4.6jar ( file name may differ depends on the version you have downloaded) and set it full path in the classpath variable.
- Find out the bin located inside the Java folder and set its path in the path variable.
Record and playback using Selenium IDE:
Open the Firefox and open the Selenium IDE from the tool menu. Make sure the record (red button ) is pressed
- Now you can start recording. Navigate to the Google.com and in the search box enter "Selenium IDE" or any other text. Now click on the first text present. Now go back to the IDE you will find the recorded steps in there.
- You need to change all the "click" command with "clickandWait". and now you can playback to see whether the recorded test cases passes or not. Just click on the green arrow button and the testcase will be loaded in browser and will be executed.