Introduction
User experience testing is a crucial element of web quality assurance. One UX testing solution we use internally is a Selenium IDE plugin for Firefox, which allows you to record interactions with multiple elements and multiple web pages, organize recorded tests into sets (suites) and save them for future use. Below is a screenshot showing Selenium IDE popup that appears in Firefox after plugin is installed and activated, with test cases organized on the left, playback and recording controls on the top, actions being recorded in the main content area on the left and log area on the bottom.
Installing Selenium IDE
-
Install Selenium IDE by visiting seleniumhq.org/download/
-
Go to the "Selenium IDE" header and you should find the link with the latest released version available. Click on the link and download Selenium.
-
Now go to your downloads directory and double click on the selenium-selenium-ide-X.X.X.xpi file.
-
Firefox (which needs to be set as your default browser) will display the following message:
-
Click "Install Now" to continue
-
You will have to restart Firefox in order to continue with the installation
-
After restarting Firefox, Selenium IDE icon will be available on browser Toolbar.
How to use
Creating a Test Case
-
Start Selenium IDE from Firefox's Tool Bar.
-
Add "Base URL" to specify web page on which the test is going to be performed. This URL can be changed to perform the same test case on a different URL.
-
Once you've added the Base URL you can press the "Record" button (red round button top right) and start performing a manual test to the site (filling inputs, clicking links, etc.).
-
As you perform your manual test, Selenium will populate its commands table with all your interactions on the page.
-
After you've finished recording your test, press the "Record" button again to stop the recording process.
-
Once your test is done recording, you can use the "Play" buttons to play either and entire Test Suite or current Test Case.
-
Right click on the test case's title, at the moment "Untitled *" and click on "Properties".
-
Here you can change the Test Case's Title to something more descriptive as you will probably have many test cases in a single Test Suite.
-
Once your test case has a title, you can proceed to save it. Click Firefox's menu File> Save Test Case As … and add a name to the file. Test Cases could be saved as HTML files.
-
If you save a Test Case as an HTML file you can later double click on it and see the table on any browser.
Editing an existing Test Case
Editing an existing Test Case it's simple:
-
Start Selenium IDE from Firefox's Tool Bar.
-
Click Firefox's menu File> Open … and browse to the Test Case file that you want to work with.
Once loaded there are several things you can do to a Test Case:
-
You can "Edit" a command
-
You can "Add" new commands
-
You can "Delete" commands
Editing a Command
-
Click on a command from the Commands Table to select it.
-
Right below the commands table you'll see the selected command's information
-
Here you can change the command executed selecting from the drop down menu. You CAN Find an Entire list of Selenium's commands in the Selenium Reference ("broken link").
-
Once a command is selected you can see a short reference at the bottom of the app, where you'll find the command's arguments and description.
-
You can also edit the target of the command by changing the target's id.
-
If you do not know the target's id you can click on "Select" and then click on the website's element you want to apply the command to, this will get you its id.
-
And finally you can change the value used with the selected command by changing the "Value" field.
-
After you've finished editing commands you can proceed to save your test case as previously explained.
Adding a new command
-
Right click anywhere on the command's table and select the "Insert New Command" option.
-
An empty new command will be added to the table.
-
Edit it as previously explained.
-
After edited, drag and drop the command to its required position.
-
After you've finished adding commands you can proceed to save your test case as previously explained.
Deleting command
-
Go to your commands table and right click on the command you want to eliminate.
-
Select "Delete" from the menu.
-
After you've finished deleting commands you can proceed to save your test case as previously explained.
Reusing Selenium Test Cases
As stated on the Selenium IDE Documentation here:
"The Base URL field at the top of the Selenium-IDE window is very useful for allowing test cases to be run across different domains. Suppose that a site named http://news.portal.com had an in-house beta site named http://beta.news.portal.com. Any test cases for these sites that begin with an open statement should specify a relative URL as the argument to open rather than an absolute URL (one starting with a protocol such as http: or https:). Selenium-IDE will then create an absolute URL by appending the open command’s argument onto the end of the value of Base URL…"
Related Links
-
Selenium Reference 1.0.1 ("broken link")