Tuesday, May 13, 2014

Selenium User Guide

Selenium User Guide

Prerequisites:
Selenium IDE : This is a Mozilla Firefox’s addon and can be downloaded from http://release.seleniumhq.org/selenium-ide/1.0.10/selenium-ide-1.0.10.xpi . An addon will ask permission for installation. Follow the steps and restart firefox. Now Selenium IDE is installed and can be accessed through Mozilla Firefox > Tools > Selenium IDE.(Note: The provided link should be opened only through Mozilla Firefox Browser)
SeleniumRCServer: This can be downloadedhttp://selenium.googlecode.com/files/selenium-remote-control-1.0.3.zip .
Nunit:Thiscanbedownloadedfromhttp://launchpad.net/nunitv2/2.5/2.5.9/+download/NUnit-2.5.9.10348.msi .
Microsoft Visual Studio
JRE 1.5 or later

Test Script types in Selenium:

Basic tabular scripts.
Advanced scripts.

Basic tabular scripts

The scripts recorded by Selenium IDE are initially in this format. These scripts are in the tabular format and run by Selenium IDE itself.


Advanced scripts


These scripts are programming language specific. And can run through Nunit + RC Server.

Steps to run Basic Scripts
Start Selenium IDE.
Go to File > Open (Navigate to the location where basic scripts are available)
Select the script(the script will be selected to run)
Click the PLAY button and the script will run.

Result Evaluation

Result can be analyzed from result status bar. If script is passed then Failure=0 and Run = 1 (in case one test script is run at a time). If script is passed then Failure=1 and Run = 0.

Steps to run Advanced scripts


Download and install Nunit, JRE 1.5 or later, Visual Studio and Mozilla Firefox.
Download Selenium RC server.
Configure dot net client drivers (as specified below)
Copy and paste the advanced script into the class1 created in Visual studio in step 3.
Click f6 to Build.
Now open command prompt.
Navigate to the location where Selenium RC is downloaded.
e.g. if it is located in ‘E’ drive then go to: “E:\selenium-remote-control-1.0.3\selenium-server-1.0.3”
In the command prompt run the command. “java -jar selenium-server.jar”. (Don’t close the command prompt)
Open Nunit.
Go to File > Open Project
Navigate to the Visual Studio 2008 > Projects > Selenium Project > Selenium Project > Bin > Debug.
Select Selenium Project.dll.
In Nunit click ‘Run’.
The script will run now in 2 Mozilla Firefox browsers and if the status will be failed then there will be a red bar in Nunit and if status will be passed then the bar will be green.
Among two browsers one will display the log and other will execute the script in GUI format.
The browsers will be automatically closed when the test case is completed.
.NET client driver configuration
.NET client Driver can be used with Microsoft Visual Studio. To configure it with Visual Studio do as Following.
1. Launch Visual Studio and navigate to File > New > Project.
2. Select Visual C# > Class Library > Name your project > Click on OK button.
3. A Class (.cs) is created. Rename it as appropriate.Under right hand pane of Solution Explorer right click on References > Add References.
4. Select following dll files - nmock.dll, nunit.core.dll, nunit.framework.dll,ThoughtWorks. Selenium.Core.dll, ThoughtWorks.Selenium.IntegrationTests.dll, ThoughtWorks.Selenium.UnitTests.dll and click on Ok button.

No comments:

Post a Comment