Technology Insights

How to initiate automation testing using Selenium IDE

By Sneha Agnihotri / December 12, 2011

The agile software methodology demands speedy testing and in the case of weekly or bi-weekly releases, it becomes extremely cumbersome to go through your application manually as a part of regression testing. Multiply your testing by the number of Browser/Operating system combinations and you have a nightmare for any QA team.

At AppDirect we use Selenium to automate actions within web applications. Here’s a quick look at how you can use Selenium to start recording tests.

Selenium has many projects that combine to make a versatile testing system - namely Selenium IDE, Selenium Remote Control, Selenium WebDriver and Selenium Grid. In this blog post we will focus on Selenium IDE, which is the first element for setting up automation testing.

Selenium IDE (Integrated Development Environment)

Selenium IDE is a Firefox add-on that makes it easy to record and playback tests in Firefox. The IDE is implemented as a Firefox extension. It not only allows you to record the tests, but edit the test script, move the commands around and debug. A tester can author tests even without learning a test scripting language.

Installing Selenium IDE

Open Firefox, download the IDE from the SeleniumHQ downloads page. After installing the add-on, you will need to restart the browser. After Firefox reboots you will find the Selenium-IDE listed under the Firefox Tools menu.

Recording Test

To start recording, click the “Start Recording” button and go through the steps of your application that you need to test. The IDE will automatically insert commands in the test case based on your actions. You can view the list of commands in the test case panel. Once you are done going through different flows in your application, click the “Stop Recording” button. You can reorder the commands or edit the values in the test case.

The most common commands used are click, clickAndWait, type and select. Verification and Assertion is also possible with the commands verifyTextPresent and verifyElementPresent.

Running Test

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. By changing the URL to point to beta or prod environments, the tester can playback the same test on respective environments.

To play/run the test, simply click the “Run” button. You can control the speed of the test by adjusting the speed control slider. As soon as the test starts running, you will see the commands getting executed in orderly fashion. When the test is running, you can also pause/stop the test at any step and start playing again.

When you run your test case, error messages and information messages showing the progress are displayed in the Log pane automatically, even if you do not first select the Log tab. These messages are often useful for test case debugging.

Test Suites

You can create multiple test cases and save them as a test suite. This functionality helps in executing a group of test cases together. Test suites are mostly used as one continuous batch-job.

Once the tests are created, you can run them against other browsers, using a simple command-line interface that invokes the Selenium-RC server and let Selenium do the testing for you!