« Back to Fireday

Selenium IDE

January 25th, 2008 at 5:00am — Rating: Firefox pointFirefox pointFirefox pointFirefox pointFirefox pointLink

OpenQA logoWhen developers create a new web application, quality assurance is a must and your reputation is on the line. You built nUnit/jUnit tests for your middle tier and your database stored procedures are working, but how do you test every aspect of your application?

You need a recording tool in your browser. We provide this functionality with week's extension review of the Selenium IDE.

Overview

Selenium IDE is used to simulate the actions of a user moving through your application as if you were actually using it.

The Selenium IDE is just one piece of this suite of applications for quality assurance. There are three other pieces of software that assist in your testing of web applications, but we'll get to those later in the review.

Installation

The Selenium IDE is not large. At 316k, this should give you an idea of how versatile the XUL language is. After the installation, the extension appears under the Tools pulldown menu. Click on the Selenium IDE to load the testing environment.

Features

When you look over the Selenium IDE screen, it may look a little intimidating, but trust me, it provides a compact interface for testing your web applications.

Selenium IDE screenshot

(picture modified using FireShot)

There are two phases to the testing process: Record your actions that the user would mimic, and create your HTML script to execute multiple Command sets.

The Selenium IDE will be in "record" mode when you activate the extension and your record button will be active. At this point, whatever screen your browser is viewing at the time, that's the web page Selenium will be recording your actions. Act just like a user and proceed with a couple of keyboard and mouse actions to get a feel for what Selenium has to offer.

Press the Record button to turn off the recorder. You'll notice the commands translated from your mouse and keyboard actions. After everything is recorded, you can save the commands to a file. This becomes your test case. Create a couple more and save them off. I'll show you a technique to run through all of them.

Under the Command List area, there is a tab called Source. If you have any commands in the list, click on the Source tab. The nice thing about Selenium is the ability to view the source of a command list. The source will be in HTML by default. There are other options for programming folk with languages such as C#, Java, PERL, Python, PHP, and Ruby. All of these languages require the additional automated testing tool called Selenium Remote Control.

Once you have created all of your test cases, download the Selenium Core. The Selenium Core allows you to create a "Test Suite" to run through all of your test cases non-stop using JavaScript, Frames, and Dynamic HTML. The great thing about this application is that it doesn't matter if you use Apache, IIS, or any other server because the entire application runs on client-based JavaScript.

Since the review is based on the Firefox extension, I'll refrain from digging deeper into Selenium Core for now. If you are interested in more, refer to the section titled Selenium Core Usage.

As you create your tests, you'll notice a Console tab and Reference tab. The Console tab displays all of your actions while Selenium is running the recorded commands in the list. The Reference tab displays help when you select a command from the dropdown list in the Editing Area.

Configuration

The configuration screen is located inside the Selenium IDE under the Options pulldown menu. Select Options to view the configuration of Selenium.

Selenium IDE General Tab Screenshot

The General tab contains additional options for extending Selenium even further by using JavaScript Selenium Core and IDE extensions. Other options include remembering the base URL, recording the absolute URL and assertTitle automatically, and the default timeout of a recorded extension.

Selenium IDE Formats Tab Screenshot

The Formats tab is only for the die-hard programmers. Most users will stick with the HTML that is available as the default. If you understand regular expressions, then venture forward and add your own format in the HTML area. Each language configuration is not as intimidating as the HTML configuration.

If your language is not available, you have the ability to add your own format, which is extending the IDE even further.

Conclusion

After using the Selenium IDE for almost two years, I've come to love this testing environment. It works with other browsers so long as the Selenium Core is downloaded and properly setup.

One of the nice features of this extension is that it doesn't stop at Firefox's extension architecture. Using the Selenium IDE is only half the battle. It goes past the idea of an extension and uses a suite of products to finalize the testing of a web application. The idea of a neutral testing environment, which runs on the standard of JavaScript (with some browsers), is a favorable tool when running a server-specific application on a common client-side platform, no matter what server-side language was used.

There is a reason why this extension is considered a Firefox Super Extension.

Selenium IDE runs a successful test of 5 out of 5.