Professional Documents
Culture Documents
in 6 Easy Steps
A CYGNET INFOTECH E -BOOK
Selenium IDE
Selenium is a package containing
various test components which
consists of the following four major
tools.
Each one of them has a specific role
in aiding the development of test
automation for a Web application.
Selenium Grid
Selenium RC
Selenium WebDriver
A well-designed object-oriented API that provides
improved support for modern advanced web-app
testing problems.
1 2 3 4 5 6
You need a framework to work with Selenium before going further.
Write some simple coding to run your automation script across all
browsers. Though there are many frameworks available in the market,
we would consider Eclipse here which is again an open source. Eclipse
is also well known tool which is behave same like STS. And there will be
no change in configuration area if you are using Eclipse.
Download Eclipse
1 2 3 4 5 6
Now, it is the time to select a language to
go ahead. We would prefer Java and thus,
give you guidelines accordingly.
1 2 3 4 5 6
The actual work will start now.
Open Eclipse tool.
1.
2.
3.
4.
5.
6.
7.
1 2 3 4 5 6
Another way to add jar file is given below.
1.
2.
3.
4.
1 2 3 4 5 6
Scripting can be written in Class file hence you need to create class file under
Java Project. Class file can be created from the path
.
If you are scared to write test cases in class, then Selenium IDE is there to help.
It will create class code for you for that you just need to understand IDE and
record the actions for which automation script is require.
Selenium IDE This is a Firefox Add-on (download it here).
Selenium IDE and install.
Download
IDE supports only Firefox hence we are using Selenium RC to run all recorded
scripts on different browsers. You can export recorded steps into selected
language format.
1 2 3 4 5 6
Base URL: http://www.google.co.in
Command
Target
open
click
id=gbqfq
type
id=gbqfq
click
id=gbqfq
Value
Testing
1 2 3 4 5 6
Now its time to run test case. Run is possible in many ways. One of the easiest ways is JUnit.
JUnit is used to run code internally which is mostly used by developer. You can use it like this:
Right click on Class file
Select Run As JUnit Test
There is one more tool available
which is used for report
creation and mostly used by
Testers named as TestNG.
1 2 3 4 5 6
TestNG can be used to create selenium report in some good format for all created test
cases. For that you need to configure it in your project. Configuration is done by
adding a jar file for TestNG into your project and installing it in Framework like Eclipse
or STS.
Download TestNG jar file from: http://beust.com/eclipse
To run code using TestNG it should be installed in your framework. To install it follow below steps.
1. Go to HelpInstall New Software..
2. Click Add button
3. Enter name as TestNG and location as http://beust.com/eclipse.
4. Click OK button.
5. Check TestNG checkbox and click Next button.
6. Finish the process.
7. Restart the STS or Eclipse to take effect.
1 2 3 4 5 6
The problem you will face is the format of code that you write for selenium script. TestNG
uses its own coding standard to interact with selenium or any other language. Format is
simple to understand so we will also use the same for some example.
1 2 3 4 5 6
Steps to create XML file.
1. Right click on project.
2. Go to TestNGConvert to TestNG
3. Verify that testng.xml file created under your project.
4. Open file, it will look like above image.
Refer this link to get more understanding of selenium with given live scenario.