Thursday, September 27, 2012

4 Recording a test script in Selenium IDE

Selenium IDE allows a user to record his user actions on webpage that he intended to test. To achieve this, go through the following steps,
  • Open Firefox browser.
  • Open Selenium IDE by clicking on Tools -> Selenium IDE.
  • Now you see, Selenium IDE is opened in recording mode. How to check if Selenium IDE is opened in recording mode? You can check this by looking at the state of the recording button. If it is in selected state that means Selenium IDE is ready to record your actions on a browser.



  • Let us now record some actions on questionselenium.blogspot.in. Now that we have Selenium IDE open in recording mode, do the following actions on Firefox browser
    1.  Type the following URL in  address bar http://questionselenium.blogspot.in/ and press Enter.
    2. Click on "Selenium IDE" tab.
    3. Click on "Installing Selenium IDE" under "Table of contents".
    4. Now get back to Selenium IDE. You will notice a group of instructions/commands populated in to Selenium IDE user interface (refer snapshot below).

 Things to be noted from above snapshot:
  1. Base URL field holds URL for questionselenium.blogspot.in. 
  2. A group of commands are populated into Selenium IDE.
This means that your user actions are recorded by Selenium IDE. Next time you play this recording, Selenium IDE will open URL present inside Base URL field i.e. http://questionselenium.blogspot.in and perform the commands recorded.


Saving a test recording.

Now that we recorded some user actions on http://questionselenium.blogspot.in, let us save this test recording.
  1. In selenium IDE, Click on File > Save Test Case.
  2. Inside "Save Test Case" window,
    • Specify location to which this recording has to be saved 
    • Specify an appropriate name to your test case.
    • Click on Save button.
Playing a test recording.

Now that we saved our recording, this can be opened in Selenium IDE and can be played.

  1. If the test case is not opened in Selenium IDE, open it by clicking on File > Open
    • Inside "Select a File" window, GoTo the location where you saved the recording.
    • Select the file you wanted to open.
    • Click on Open button.
  2. Now to play a test recording opened in Selenium IDE, Click on "Play current test case" button (refer snapshot below)

  
You will observe that the Selenium IDE will open http://questionselenium.blogspot.in and perform the list of actions in the same order that you have recorded.

Note:
  1. Before you click on Play, maximize your Firefox browser to view execution of recorded script(automation).
  2. Selenium IDE will generate log for the current execution inside Log tab.
  3. During execution of the test case,
    • A test command in Yellow - Command under execution.
    • A test command in green - Command succesfully run.
    • A test command in red - Command failed. Report error in the log.   






Running multiple test recordings - Running Test Suite

You can record as many test recordings as you wish. To record a new test in Selenium IDE, GoTo File > New Test Case.

Record your new test case and save it as explained earlier in this post. Please note that before your record anything make sure recording button is enaled.

Now that we have a list of test recordings, we can save them as a "Test Suite". In order to save a group of test recordings as a test suite, click on File > Save Test Suite. Give an appropriate name to your test suite and save it.

To run a test suite, first open it in Selenium IDE and click on "Play entire test suite" button. (refer snapshot below)












Definitions

  • Test Recording/ Test Case: It is a set of instructions performed to test functionality of a feature inside an application.
  • Test Suite: It is a set of test cases that test various features of an application.
  • Automation: It is the process of developing and maintaining test recordings, test cases, test suites and programs that when executed, performs user actions and validation on applications we intended to test, with no human effort.

4 comments:

  1. Thanks for a great information in your blog. I have read all the post of your blog. Great work on SELENIUM.
    http://thecreatingexperts.com/software-testing-training-in-chennai/selenium-training-in-chennai/

    ReplyDelete
  2. Thanks for sharing this information.It was very nice blog to learn about Selenium.
    http://thecreatingexperts.com/software-testing-training-in-chennai/selenium-training-in-chennai/

    ReplyDelete

 

QuestionSelenium Copyright @Shiva Krishna