Friday, January 21, 2011

Recording and Running Tests in Selenium IDE

Recording in Selenium IDE

1. Open Firefox
2. Click on Tools menu, select "Selenium IDE"
3. Click on the red record button on the right (as shown in the following figure
Figure: Recording button
4. Browse to google.com and enter "Selenium" in the search box and click on "Google Search" button
5. Click on the first result, which is that of seleniumhq.org
6. Stop the recording by clicking on again the red record button (See the above figure)

You should see something like below once you recording is done.

Figure: Selenium IDE Recorded Scripts

Running Recorded Selenium Test:

To run the above Selenium recorded script you need little modifications. Replace the last command "click" to "clickAndWait" (We will discuss this in later)

To make the above modification, highlight the line, in the "Command" text box, replace the "click" with "clickAndWait" (see the below figure)

Figure: Editing a Selenium Command
Now to run your recorded test, click on "Run current test case" (second Green arrow button)

The IDE should play your recorded test. After the test is complete you should have landed on the selenium page (http://seleniumhq.org/). The IDE after the test run is shown below. In the "Log Section" you can see the various events run by the test. In the table tab you can see that all the rows are green, which means that the test ran successfully.

Also at the bottom left, it will shown number of test cases passed and failed (Highlighted in the below screen shot)


Figure: Selenium Test Result