How to Create a Test Suite in Selenium

Nov 09, 2011
Belen Padilla

In my previous posts, Selenium IDE for Automated Testing and Selenium-RC for Automated Testing, I wrote about Selenium IDE and Selenium RC and I used a simple test case “GoogleSignUpErrors” to show you how to create and execute a single test case using both tools.

In this post, I am going to show you how to create a test suite in Selenium IDE and run the group of test cases using Selenium RC. 

Let’s assume you have already created “GoogleSignUpErrors” test case, if not you can check the post: Selenium IDE for Automated Testing.

In this basic test case, I just recorded the actions to submit an empty Google Sign up form.

For the test suite, let’s create another test case in Selenium IDE: ” GoogleSignUpForm”. In this test case I am just going to go to the Google Sign Up page and add verifications to check the labels that appear for each field the Sign Up form. See the recorded actions:

Now we have 2 test cases:

  • GoogleSignUpForm: which tests which fields are present in the Sign Up form
  • GoogleSignUpErrors: which tries to submit the form without required fields

Create a test suite in Selenium IDE

To create a test suite in Selenium IDE:

  1. Open Selenium IDE
  2. Go to File>New Test Suite
  3. To add test cases:  Go to File>Add test case
  4. Navigate to the location of your test case
  5. Click on Add
  6. Repeat steps 3-5 for more test cases

The Test suite that contains GoogleSignUpForm and GoogleSignUpErrors:

You can export the test suite to all the supported languages: HTML, Java, Groovy, C#, Perl, PHP, Phyton and Ruby.

Test suite exported as HTML

After you added test cases to your test suite, to export it as HTML, simply:

  1. Go to File>Export as HTML
  2. Enter a file name
  3. Click on Save

In the HTML file, the test suite is a table in which each entry is a test case link:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "">
<html xmlns="" xml:lang="en" lang="en">
  <meta content="text/html; charset=UTF-8" http-equiv="content-type" />
  <title>Test Suite</title>
<table id="suiteTable" cellpadding="1" cellspacing="1" border="1" class="selenium"><tbody>
<tr><td><b>Test Suite</b></td></tr>
<tr><td><a href="file:///C:\SeleniumTestSuite\GoogleSignUpForm.html>GoogleSignUpForm</a</td></tr>
<tr><td><a href="file:///C:\SeleniumTestSuite\GoogleSignUpErrors.html">GoogleSignUpErrors</a></td></tr>

You need to add “file:///” at the beginning of the path location of your test cases to run them from the command line, otherwise you will get this error:
“Firefox doesn't know how to open this address, because the protocol(c) isn't associated with any program”

Run a HTML test suite using Selenium-RC

After you generated your HTML suite file, you can run the suite using –htmlSuite command.

-htmlSuite requires you to specify:

  • browserString (e.g. "*firefox")
  • startURL (e.g. "")
  • suiteFile (e.g. "c:\absolute\path\to\my\HTMLSuite.html")
  • resultFile (e.g. "c:\absolute\path\to\my\results.html")

Follow these steps to run the suite:

  1. Create a HTML file that will keep your test results
  2. Open a command line
  3. cd to the selenium-server.jar location.

    For example: cd C:\selenium-remote-control-1.0.3\selenium-server-1.0.3

  4. Run the command with the required arguments. For example:

    java -jar selenium-server.jar -port 4546 -htmlSuite *firefox "" "c:\SeleniumTest\TestSuite.html" "C:\test.html"

You will see how Test runner is invoked and starts running the test in Firefox.

In case Test runner does not start running the test cases, ensure pop-up windows are enabled in your browser.

After the test script is done, you can check the test results in the HTML file you provided as argument.


Selenium Project: