animind - Fotolia

Get started Bring yourself up to speed with our introductory content.

How and why to do parallel testing

Parallel testing can be a boon to test coverage and test execution times. But while the practice is quite adoptable, testers still need a well-thought-out implementation strategy.

IT organizations adopt continuous testing to increase software quality and velocity, in particular as part of a CI/CD pipeline and DevOps approach. However, continuous testing requires effective and streamlined test automation. Enter parallel testing: an advanced technique that enables broad test coverage in the shortest execution time possible.

Parallel testing is a way to execute several test automation scripts simultaneously, each script consuming different resources. You can test different application components on separate computers, or run test scripts on various devices and browsers at the same time.

Let's walk through all the ways in which parallel testing ensures efficient test automation; how testers can implement the practice with good test suites, cases and scripts; and the tools, like Selenium, they may need to do the job.

Parallel testing advantages

With parallel testing, the number of tests that a QA engineer executes simultaneously can exponentially reduce the time needed to run the whole test suite. Accordingly, parallel tests increase velocity.

With tests done faster, feedback arrives more quickly, or even continuously, which supports a CI/CD pipeline. Continuous feedback helps the software team to find and fix defects sooner and eliminate bottlenecks. 

Parallel testing allows for wider test coverage than sequential tests in the same timeframe. It reduces the risk inherent in device fragmentation. Fragmentation happens when devices run different operating system versions, and applications are coded individually based on the OS. This kind of app design increases the number of combinations for QA to test. With a broader range of device/platform/browser combinations in the same amount of test time, QA can also test against less common ones. To increase test coverage in less time also reduces the need for risk-based testing, a QA approach that prioritizes testing functions and features with higher risks of failure.

Depending on the test environment, parallel testing doesn't have to be expensive. If the team uses pay-per-use VMs to run tests on the cloud, rather than capital investments in on-premises infrastructure, the tests won't eat up a lot of resources. However, cloud VMs aren't free. Also, if an IT organization already has significant on-premises server investments, it may want to just spin up VMs locally during low workload times.

Parallel testing implementation

Parallel testing is flexible and QA can implement it easily to go with current practices. An implementation strategy should include cloud, test suite and test script optimization, and a focus on time.

Have cloud infrastructure in place. Parallel execution on local infrastructure can be costly: You need multiples of hardware, software and possibly mobile devices to run tests simultaneously. By contrast, public cloud infrastructure is priced by usage. In a cloud-based testing environment, QA can spin up many VMs to run scripts on several configurations at the same time, then deactivate them. There's no ongoing cost, and usage is high but short.

Review and optimize the test suite. It's tempting to include every test case to increase test coverage. However, to plan parallel testing effectively and efficiently, prioritize tests in the suite. Choose tests that cover the highest risks to the application in terms of code complexity and critical business workflows.

Make test scripts atomic. Test scripts must only explore one scenario. This practice helps QA to define the objective of the test and document defects precisely.

Run autonomous test scripts. In parallel execution, one test cannot rely on the results of another. With autonomous test scripts, QA reduces the number of blocked tests during a test run.

Consider data management. Ensure that each script restores test data back to its original state to avoid problems for other tests.

Make sure tests run quickly. Testing time per script should be a minute or less on the local environment.

Parallel testing tools

Many test automation tools, both open source and commercial, facilitate parallel testing.

Selenium, an open source tool, is one of the most flexible, especially when testers combine it with TestNG. TestNG is a Java framework based on JUnit and NUnit. When used with Selenium, TestNG makes it easy to organize test suites for parallel testing.

Cucumber is an open source automation tool that testers most frequently use for behavior-driven development. QA professionals can implement parallel testing with Cucumber by using either JUnit or TestNG. JUnit can run feature sets in parallel, whereas TestNG executes Cucumber scenarios in parallel.

Mobile applications greatly benefit from parallel tests, especially when it opens up cross-browser and cross-device testing. A mobile automation tool, however, is necessary. Appium, an open source mobile automation testing tool, has the ability to run parallel tests across Apple iOS, Android and Microsoft Windows desktops.

Dig Deeper on Automated and autonomous testing

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.