Jul 02
Creating a Selenium test suite
Posted by James Netherton | Monday 02 July 2007 5:00 AM | In Testing
Most testing frameworks have the concept of grouping a set of text fixtures into a 'suite' so that you can execute a number of related tests together.
Creating test suites with Selenium doesn't appear to be obvious at first. Here's a simple guide on how to create and execute suites of functional tests:
You can run test suites via the Selenium web browser application. You'll need to download the Selenium Core in order to do this. After you have extracted the downloaded file, copy the 'core' directory to somewhere that is accessible under your server web root (E.g the document root). Browse to http://your server/path to selenium core/TestRunner.html and you should see the Selenium test runner application.
In order to create a test suite, all you have to do is create an HTML document that is composed of a table of links to your individual unit tests. For example:
<head>
<title>My Application Test Suite</title>
</head>
<body>
<table>
<tr><td><b>Suite Of Tests</b></td></tr>
<tr><td><a href="./TestLogin.html">Test Login</a></td></tr>
<tr><td><a href="./TestFormEntry.html">Test Form Entry</a></td></tr>
<tr><td><a href="./TestFormSave.html">Test Form Save</a></td></tr>
</table>
</body>
</html>
Obviously you'll need to adjust the href's to wherever you have your test cases stored, but essentially that is all there is to creating a test suite.
Now return to the Selenium test runner application and alter the unit test path so that it finds the HTML file containing your test suite definition. When the page reloads you should see all of your individual unit tests listed within the frame on the left hand side. You now have the option of executing all tests within the suite or run selected tests.
The test runner reports results in the usual manner, stating the number of passes, failures or number of cases where errors were encountered within the actual test scripts.
All of this is quite handy because as I mentioned in my previous post, you could run a suite of tests as part of a continuous integration process upon application deployment or commits to a code repository.
3 Comments
[Post comment]
1
Posted by roger pack | Tuesday 02 October 2007 11:54 AM
With Ruby on Rails the integrated plugin for selenium will generate the index for you
2
Posted by Madhavi | Tuesday 22 January 2008 9:20 AM
hi,
Do you know any way to inbed one test suite into another. I need to create smaller test suites for each functionality and include those test suites into the master test suite.
Please let me know if you know any way out.
Regards,
Madhavi
3
Posted by Lindsay | Monday 05 May 2008 12:21 AM
Hi, do you know of any way to run all cases in a test suite in a batch, ie. not having to run each individually?
cheers,
Lindsay