Title: Selenium
1Selenium Testing Tool
2What is Selenium?
- Selenium is a robust set of tools that
supports rapid development of test automation for
web-based applications. - Works anywhere JavaScript is supported
- Hooks for many other languages - Java, Ruby,
Python - Can simulate a user navigating through pages
and then assert for specific marks on the pages - All you need to really know is HTML to start
- using it right away
3Selenium
- You can use open source - Selenium tool
- Selenium IDE is a plug-in to Firefox to record
and playback tests (like WinRunner, QTP). - You can then export the recorded test in most
language e.g. HTML, Java , .NET , Perl , Ruby
etc. - The exported test can be run in any browser and
any platform using "selenium remote control".
4Where to get it?
You can use Selenium-Core and customize
everything deprecated. But it is easier to
just get a Firefox plug-in Selenium-IDE
that helps you record test Cases. You
can record how an app is being used and then
playback those recordings followed by asserts.
Get everything at www.openqa.org/selenium/
5Selenium Components
6- Selenium-IDE
- Integrated Development Environment for building
Selenium test cases. - Operates as a Firefox add-on and provides an
interface for developing and running individual
test cases or entire test suites. - Selenium-IDE has a recording feature, which will
keep account of user actions as they are
performed and store them as a reusable script to
play back. - It also has a context menu (right-click)
integrated with the Firefox browser, which allows
the user to pick from a list of assertions and
verifications for the selected location. - Offers full editing of test cases.
- Although it is a Firefox only add-on, tests
created in it can also be run against other
browsers by using Selenium-RC specifying the
name of the test suite on the command line.
7- Selenium-RC (Remote Control)
- Selenium-RC provides an API (Application
Programming Interface) and library for each of
its supported languages HTML, Java, C, Perl,
PHP, Python, and Ruby. - This ability to use Selenium-RC with a high-level
programming language to develop test cases also
allows the automated testing to be integrated
with a projects automated build environment.
8- Selenium-Grid
- Selenium-Grid allows the Selenium-RC solution to
scale for test suites or test suites to be run in
multiple environments. - With Selenium-Grid multiple instances of
Selenium-RC are running on various operating
system and browser configurations, each of these
when launching register with a hub. When tests
are sent to the hub they are then redirected to
an available Selenium-RC, which will launch the
browser and run the test. - This allows for running tests in parallel, with
the entire test suite theoretically taking only
as long to run as the longest individual test.
9Steps to start with Selenium!
1) Begin write and run tests in
Firefox. Selenium IDE is a Firefox add-on that
records clicks, typing, and other actions to make
a test, which you can play back in the
browser. 2) Customize your language, your
browser. Selenium Remote Control (RC) runs your
tests in multiple browsers and platforms. Tweak
your tests in your preferred language. 3)
Deploy scale out, speed up Selenium Grid extends
Selenium RC to distribute your tests across
multiple servers, saving you time by running
tests in parallel.
10Supported Browsers Tests developed on Firefox
via Selenium-IDE can be executed on any other
supported browser via a simple Selenium-RC
command line.
11Selenium Commands Selenese
- 1) Actions are commands that generally manipulate
the state of the application. They do things like
click this link and select that option. - Can be called with AndWait suffix, e.g.
clickAndWait. - 2) Accessors examine the state of the application
and store the results in variables, e.g.
storeTitle. - They are also used to automatically generate
Assertions. - 3) Assertions are like Accessors, but verify that
the state of the application conforms to what is
expected. Eg. make sure the page title is X,
verify that this checkbox is checked. - All Selenium Assertions can be used in 3 modes
assert, verify, and waitFor. For example,
you can assertText, verifyText and
waitForText.
12Selenium IDE
The list of actions in
the actual test case to
execute The root of web
application you want to test The log of
the events that were executed, including any
errors or warning that may have occurred
13Selenium IDE
Execution Commands
Record test actions
Try the test in the Web based TestRunner
Reference of the currently selected command
Specify commands, including asserts
14Test Suite
Execution Control
Test Cases
Steps of the test case
Application being tested
15TestRunner Control
16TestRunner Control
Run Selected Test
Pause/Play Execution
Step through Execution
Run All Tests
Control Speed of Execution
Highlight Elements in the Execution
Summary of the Test
View the log of the current execution
View the DOM of the current Page being tested
17Test Creation Demo in http//test.roosterit.com/
18Login to http//test.roosterit.com/ Click on
Tools Selenium IDE
19Selenium IDE in recording Mode
20Add Consultant Details
21Click On Submit
22Inserted Successfully
23Selenium IDE records the Test StepsStop
Recording
24Save Test Case/Test Suite
25Make the required changes to the Test Case
change Click to clickAndWait command
26Make the required changes to the Test Case
change the email id in the second parameter
Make other changes
27- Second Test CasesearchConsultant
- Record
- Stop Recording
- Save with a Name
- Make Required Changes to parameters or Commands
- Play
28Run the entire Test Suite/Each Test CaseSee
RESULT Here
29Test Suite on Firefox
30addConsultant Test Case
31Changes made toaddConsultant Test Case
32searchConsultant Test Case
33Test Case Saved in HTML Tabular Format
34Creating a Test Suite
A Test Suite in Selenium is just an HTML file
that contains a table of links to tests
lt?xml version"1.0" encoding"UTF-8"?gt lt!DOCTYPE
html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http//www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd
"gt lthtml xmlns"http//www.w3.org/1999/xhtml"
xmllang"en" lang"en"gt ltheadgt ltmeta
content"text/html charsetUTF-8"
http-equiv"content-type" /gt lttitlegtTest
Suitelt/titlegt lt/headgt ltbodygt lttable
id"suiteTable" cellpadding"1" cellspacing"1"
border"1" class"selenium"gt lttbodygt lttrgtlttdgtltbgtTe
st Suitelt/bgtlt/tdgtlt/trgt lttrgtlttdgtlta
href"addConsultant.html"gtaddConsultantlt/agtlt/tdgtlt/
trgt lttrgtlttdgtlta href"searchConsultant"gtsearchConsu
ltantlt/agtlt/tdgtlt/trgt lt/tbodygt lt/tablegt lt/bodygt lt/ht
mlgt
35TestRunner Demo
Execute Tests created inside the Firefox
TestRunner.
36addConsultant TestRunner Mode
37searchConsultant in Execution Mode - TestRunner
38Questions?