Back to Resources


Posted November 26, 2012

Running Automated Tests in Parallel (Part 1)


This post was originally written by Alan Parkinson of Hindsight Software. One of Sauce's authorized partners, Hindsight Software specializes in building tools and services around Selenium and test automation. It has been reprinted with his permission. Automated functional tests provide valuable feedback to developers by notifying them when they have completed or broken functionality. The value of these tests can be maximised by providing the test results in the shortest possible time. The reason being the problem is likely to be fresh in the developer's mind and quicker for them to fix. A typical functional or UI test suite can take many hours to run because the tests can only be run sequentially. The main cause for the sequential tests is the dependence on data. Common practice has test cases clear the database of the application under test and populate it with the required data before it starts. This high level of database manipulation does not allow the tests to be run in parallel because each test will interfere with the database at different times, therefore corrupting data required used by other tests.

The common solution for long running test suites is to break them into batches and run each batch on a separate machine with its own instance of the application under test and its database. This is easy to achieve using spare hardware, Virtual Machine's or Cloud computing resources. You don't even have to write code for spinning up new machines, or access remote machines, as Continuous Integration (CI) servers like Jenkins and Bamboo provide functionality for running builds on multiple computers. This feature is better known as Slaves or Agents. The majority of the popular testing tools have ways of grouping tests together and we can use this feature to create our "Batches" of tests. These features are known as "categories" in JUnit, "groups" in TestNG and "tags" in Cucumber, Lettuce and Behat. To continue reading this post, jump over to the Hindsight blog

Nov 26, 2012
Share this post
Copy Share Link
© 2023 Sauce Labs Inc., all rights reserved. SAUCE and SAUCE LABS are registered trademarks owned by Sauce Labs Inc. in the United States, EU, and may be registered in other jurisdictions.