The following steps are involved in recording, creating, saving and executing Selenium tests using IDE:
- Recording and adding commands in a test
- Saving the recorded test
- Saving the test suite
- Executing the recorded test
Recording and Adding Command in a Test
Step 1. Open Firefox Browser
Step 2. Enter URL for the site you want test.
Step 3. Go to Tools > Selenium IDE and open Selenium IDE.
Step 4. IDE is already in a recording mode. If not, press red button to start recording.
Step 5. Record your steps from your URL as you want and then stop recording by clicking Stop recording button in record toolbar.
Step 6. Verify the steps below that are recorded Selenium IDE.
If you look at the above steps, First column – “Command” represents the operation or method performed on user controls. For example type method to enter value in username field.
Second column – “Target” represents the user controls of the application on which actions are done.
Third column – “Value” represents all the input data that has been entered into the application for testing.
Save the script using IDE
Step 1. Select File > Save Test Case
Step 2. Save the test Cases in your machine like “C:\Selenium” folder and name it as MYFirstIDEScript.
Saving the Test Suite
A test suite is a collection of tests that can be executed as a single entity.
Step 1. Save a test suite by navigating to “File” >> “New Test Suite” as shown below.
Step 2 : The tests can be recorded one by one by choosing the option “New Test Case” from the “File” Menu.
Step 3 : The individual tests are saved with a name along with saving a “Test Suite”.
Running the Test cases
The IDE allows many options for running your test case. You can run a test case all at once, stop and start it, run it one line at a time, run a single command you are currently developing and you can do a batch run of an entire test suite.
Run a Test Case – Click the Run button to run the currently displayed test case.
Run a Test Suite – Click the Run All button to run all the test cases in the currently loaded test suite.
Stop and Start – The pause button can be used to stop the test case while it is running. The icon of this button then changes to indicate the Resume button. To continue click Resume button.
Stop in the Middle – You can set a breakpoint in the test case to cause it to stop on a particular command. This is useful for debugging your test. To set a breakpoint, select a command, right click and from the context menu select Toggle Breakpoint.
Start from Middle – You can tell the IDE to begin running from a specific command in the middle of the test case. This also is used for debugging. To set a start point, select a command, right click and from the context menu select Set/Clear Start Point.
Run Any Single Command – Double click any single command to run it by itself. This is useful when writing a single command. It lets you immediately test a command you are constructing, when you are not sure if it is correct. You can double-click it to see if it runs correctly, this is also available from the context menu.
Step 1 – Click on Run button and Run and verify test case run until completion.
Step 2 – Verify the result in the Log tab. After executing each step, the background of the test step turns “Green” if passed and “Red” if failed as shown below.
Leave a Reply Cancel reply