P. 1


|Views: 0|Likes:
Published by Manoj Kumar

More info:

Published by: Manoj Kumar on Jul 31, 2012
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as PPT, PDF, TXT or read online from Scribd
See more
See less





Selenium – Testing Tool

What 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

• 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".

• Get everything at: www.openqa.org/selenium/ . • But it is easier to just get a Firefox plug-in “Selenium-IDE” that helps you “record” test Cases.Where to get it? • You can use Selenium-Core and customize everything – deprecated. • You can record how an app is being used and then playback those recordings followed by asserts.

Selenium Components .

which will keep account of user actions as they are performed and store them as a reusable script to play back. • Operates as a Firefox add-on and provides an interface for developing and running individual test cases or entire test suites. • Offers full editing of test cases. which allows the user to pick from a list of assertions and verifications for the selected location. . • Selenium-IDE has a recording feature. 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. • Although it is a Firefox only add-on. • It also has a context menu (right-click) integrated with the Firefox browser.Selenium-IDE • Integrated Development Environment for building Selenium test cases.

Perl.Selenium-RC (Remote Control) • Selenium-RC provides an API (Application Programming Interface) and library for each of its supported languages: HTML. • 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 project’s automated build environment. Python. PHP. and Ruby. C#. Java. .

which will launch the browser and run the test. each of these when launching register with a hub.Selenium-Grid Selenium-Grid allows the Selenium-RC solution to scale for test suites or test suites to be run in multiple environments. • This allows for running tests in parallel. . When tests are sent to the hub they are then redirected to an available Selenium-RC. • With Selenium-Grid multiple instances of Selenium-RC are running on various operating system and browser configurations. with the entire test suite theoretically taking only as long to run as the longest individual test.

Steps to start with Selenium! 1) Begin: write and run tests in Firefox. Tweak your tests in your preferred language. speed up Selenium Grid extends Selenium RC to distribute your tests across multiple servers. typing. 2) Customize: your language. . Selenium Remote Control (RC) runs your tests in multiple browsers and platforms. which you can play back in the browser. 3) Deploy: scale out. your browser. and other actions to make a test. saving you time by running tests in parallel. Selenium IDE is a Firefox add-on that records clicks.

run tests Start browser. Browser Firefox 3 Firefox 2 IE 8 IE 7 Safari 3 Safari 2 Opera 9 Opera 8 Google Chrome Test execution only via Selenium-RC Test execution only via Selenium-RC Test execution only via Selenium-RC Test execution only via Selenium-RC Test execution only via Selenium-RC Test execution only via Selenium-RC(Windows) Test execution only via Selenium-RC 1. Mac Windows.0 Beta-1 & 1. run tests Record and playback tests 1.Supported Browsers * Tests developed on Firefox via Selenium-IDE can be executed on any other supported Selenium-IDE Selenium-RC Operating Systems Windows. Linux. run tests Start browser. run tests Start browser.0 Beta-2: Start browser. run tests Start browser. Mac Windows browser via a simple Selenium-RC command line. Mac Windows Windows Mac Mac Windows. run tests Others Partial support possible As applicable . Linux. Mac Windows.0 Beta-1: Record and Start browser. run tests Start browser. Linux. run tests playback tests Under development Start browser. Linux.

“clickAndWait”. “verify”.g. “storeTitle”. . • Can be called with “AndWait” suffix. you can “assertText”. • They are also used to automatically generate Assertions. “verify that this checkbox is checked”. but verify that the state of the application conforms to what is expected. They do things like “click this link” and “select that option”. e.g. “make sure the page title is X”. Eg. 3) Assertions are like Accessors. • All Selenium Assertions can be used in 3 modes: “assert”. For example. e. 2) Accessors examine the state of the application and store the results in variables.Selenium Commands – Selenese 1) Actions are commands that generally manipulate the state of the application. and ” waitFor”. “verifyText” and “waitForText”.

Selenium 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 .

including asserts .Selenium IDE Execution Commands Record test actions Try the test in the Web based TestRunner Reference of the currently selected command Specify commands.

Test Suite Execution Control Test Cases Steps of the test case Application being tested .

TestRunner Control .

Run Selected Test TestRunner Control Pause/Play Execution Step through Execution Run All Tests Control Speed of Execution Highlight Elements in the Execution Summary of the Test View the DOM of the current Page being tested View the log of the current execution .

roosterit.Test Creation Demo in http://test.com/ .

Login to http://test.com/ Click on Tools || Selenium IDE .roosterit.

Selenium IDE in recording Mode .

Add Consultant Details .

Click On Submit .

Inserted Successfully .

Selenium IDE records the Test Steps Stop Recording .

Save Test Case/Test Suite .

Make the required changes to the Test Case change Click to clickAndWait command .

Make the required changes to the Test Case – change the email id in the second parameter Make other changes .

Second Test Case: searchConsultant 1) Record 2) Stop Recording 3) Save with a Name 4) Make Required Changes to parameters or Commands 5) Play .

Run the entire Test Suite/Each Test Case See RESULT Here .

Test Suite on Firefox .

addConsultant Test Case .

Changes made to addConsultant Test Case .

searchConsultant Test Case .

Test Case Saved in HTML Tabular Format .

html">addConsultant</a></td></tr> <tr><td><a href="searchConsultant">searchConsultant</a></td></tr> </tbody> </table> </body> </html> .dtd"> <html xmlns="http://www. charset=UTF-8" http-equiv="content-type" /> <title>Test Suite</title> </head> <body> <table id="suiteTable" cellpadding="1" cellspacing="1" border="1" class="selenium"> <tbody> <tr><td><b>Test Suite</b></td></tr> <tr><td><a href="addConsultant.Creating a Test Suite A Test Suite in Selenium is just an HTML file that contains a table of links to tests <?xml version="1.w3.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.w3.org/TR/xhtml1/DTD/xhtml1-strict.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta content="text/html.0 Strict//EN" "http://www.

.TestRunner Demo Execute Tests created inside the Firefox TestRunner.

addConsultant TestRunner Mode .

searchConsultant in Execution Mode .TestRunner .

Questions? .

You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->