Selenium-RC allows the test automation developer to use a programming language for maximum flexibility and extensibility in developing test logic. For instance, if the application under test returns a result set, and if the automated test program needs to run tests on each element in the result set, the programming language’s iteration support can be used to iterate through the result set, calling Selenium commands to run tests on each item.
1. Selenium – Testing Tool
3. Selenium• 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".
4. Where 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 thenplayback those recordings followed by asserts.• Get everything at: www.openqa.org/selenium/
5. Selenium 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 project’s automated build environment.
8. Selenium-GridSelenium-Grid allows the Selenium-RC solution to scale fortest suites or test suites to be run in multiple environments.• With Selenium-Grid multiple instances of Selenium-RC arerunning on various operating system and browserconfigurations, each of these when launching register with ahub. When tests are sent to the hub they are then redirectedto an available Selenium-RC, which will launch the browserand run the test.• This allows for running tests in parallel, with the entire testsuite theoretically taking only as long to run as the longestindividual test.
9. Steps 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 inthe browser.2) Customize: your language, your browser.Selenium Remote Control (RC) runs your tests in multiplebrowsers and platforms. Tweak your tests in your preferredlanguage.3) Deploy: scale out, speed upSelenium Grid extends Selenium RC to distribute your testsacross multiple servers, saving you time by running tests inparallel.
10. Supported Browsers * Tests developed on Firefox via Selenium-IDE can be executed on any other supported browser via a simple Selenium-RC command line.Browser Selenium-IDE Selenium-RC Operating Systems 1.0 Beta-1 & 1.0 Beta-2:Firefox 3 Start browser, run tests Windows, Linux, Mac Record and playback tests 1.0 Beta-1: Record andFirefox 2 Start browser, run tests Windows, Linux, Mac playback testsIE 8 Under development Windows Test execution only viaIE 7 Start browser, run tests Windows Selenium-RC Test execution only viaSafari 3 Start browser, run tests Mac Selenium-RC Test execution only viaSafari 2 Start browser, run tests Mac Selenium-RC Test execution only viaOpera 9 Start browser, run tests Windows, Linux, Mac Selenium-RC Test execution only viaOpera 8 Start browser, run tests Windows, Linux, Mac Selenium-RC Test execution only viaGoogle Chrome Start browser, run tests Windows Selenium-RC(Windows) Test execution only viaOthers Partial support possible As applicable Selenium-RC
11. Selenium Commands – Selenese1) 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”.
12. Selenium IDE The list of actions in the actual test case to executeThe root of webapplication youwant to testThe log of theevents that wereexecuted, includingany errors orwarning that mayhave occurred
13. Selenium IDEExecution Record testCommands actions Try the test in the Web based TestRunnerReference of thecurrently selectedcommand Specify commands, including asserts
14. Test Suite Execution Control Test CasesSteps of thetest case Application being tested
15. TestRunner Control
16. Run Selected Test TestRunner Control Pause/Play Execution Step through ExecutionRun All Tests Control Speed of ExecutionHighlight Summary ofElements in the the TestExecution View the log of View the DOM the current of the current execution Page being tested
17. Test Creation Demo inhttp://test.roosterit.com/
18. Login to http://test.roosterit.com/ Click on Tools || Selenium IDE
19. Selenium IDE in recording Mode
20. Add Consultant Details
21. Click On Submit
22. Inserted Successfully
23. Selenium IDErecords the TestStepsStop Recording
24. Save Test Case/Test Suite
25. Make therequiredchanges tothe Test Casechange ClicktoclickAndWaitcommand
26. Make the requiredchanges to the TestCase – change theemail id in thesecond parameter Make other changes
27. Second Test Case: searchConsultant1) Record2) Stop Recording3) Save with a Name4) Make Required Changes to parameters or Commands5) Play
28. Run the entire Test Suite/Each Test Case See RESULT Here
29. Test Suite on Firefox
30. addConsultant Test Case
31. Changes made toaddConsultantTest Case
32. searchConsultant Test Case
33. Test Case Saved in HTML Tabular Format
34. Creating a Test SuiteA Test Suite in Selenium is just an HTML file that contains a table of links to tests<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head> <meta content="text/html; 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.html">addConsultant</a></td></tr> <tr><td><a href="searchConsultant">searchConsultant</a></td></tr> </tbody> </table></body></html>
35. TestRunner DemoExecute Tests created inside the Firefox TestRunner.
36. addConsultant TestRunner Mode
37. searchConsultant in Execution Mode - TestRunner