Best Practices for Parallel Testing Across Desktop, Web, and Mobile

  Februar 13, 2020

UI tests have a reputation for being brittle and time consuming — especially when testing across different platforms. While there's no getting around the need for a browser, device or emulator, there are some strategies that you can use to create more robust tests and speed up the process. It's possible to incorporate UI tests into an Agile development process.

Let's take a look at how parallel testing can help you derive real value from your UI tests by speeding up the process, as well as how other tools can make them more robust.

What is Parallel Testing? 

Most UI tests are run sequentially on a continuous integration server before a merge or deployment. For instance, you may run a UI test suite overnight prior to a deployment planned for the following day to ensure that nothing is broken. These tests may incorporate multiple platforms that each require their own environments set up to emulate browsers or devices.

Parallel testing cuts down on the time it takes to run UI tests by running multiple tests at the same time. For example, Apple's Xcode 9 enabled developers to simultaneously run different tests on different devices, improving test times by magnitudes of order. These same capabilities have become available across other platforms over time.

Unlike distributed testing, parallel testing doesn't necessarily test parts that interact with each other. You can test multiple applications or subcomponents of one application concurrently to reduce the overall test time. The result is a faster UI test that can be more effectively used in the Agile development process to deliver earlier insights into potential issues.

Parallel Testing Best Practices

Parallel testing is similar to asynchronous web development in that there are some important differences to keep in mind. In particular, you can no longer assume that tests are running in any specific order, which means that it's important to ensure that the environment remains untouched and no shared resources are off-limits to specific tests.

Some best practices to keep in mind include:

  • Make it autonomous. The test shouldn't rely on the outcome of another test to run since parallel tests don't necessarily occur in any specific order.
  • Test one feature at a time. The test should only test a single feature at a time. A test that runs through many features defeats the purpose of parallel testing. 
  • Don't use static objects. The test should not use any static objects. The use of a static object could prevent another test running in parallel from accessing it.
  • Reset the test data. The test should leave the system the way it was prior to the test. Create, use and tear down test data with each test to avoid cross-contamination of data.

The best way to adhere to these best practices is to use a platform that automatically incorporates them. After all, a single mistake in designing the tests should cause an error that's difficult to diagnose given the parallel nature of the tests. Platforms like TestComplete make it easy to adhere to these best practices and automate the UI testing process.

TestComplete Simplifies the Process

TestComplete is an automated UI testing platform with a hybrid object and visual recognition engine that tests every desktop, web and mobile application. With an easy-to-use interface, you can create tests with or without writing scripts and easily incorporate the tests into a continuous integration and deployment process to improve your Agile workflow.

Parallel Testing in TestComplete

The platform supports desktop, web and mobile tests using a wide range of technologies, including .NET, AngularJS, Java, WPF, Oracle, HTML5, iOS, and Android. You can easily set up these tests to run in parallel remotely via Jenkins, Azure DevOps or other continuous integration (CI) platforms or by using a command-line interface (CLI) or REST API.

How it Works

TestComplete makes it easy to run UI tests in parallel and solves many of the challenges with manually setting up parallel testing with open source tools.

There are a few simple steps to get started:

  1. Create individual projects that test different parts or functional characteristics of your application.
  2. Copy the projects to the computers that should run the test.
  3. Start running the projects at once or with a delay.

Note: You can use TestComplete or TestExecute to run these tests. TestExecute is a resource-friendly utility designed to run test projects without TestComplete installed.

The reports generated by TestComplete are available in Unit, HTML or MHT to share with other stakeholders. Screenshots captured during the test execution can help troubleshoot any UI inconsistencies during the recording and running phases. You can also access a detailed log of all actions that were performed across different physical and virtual machines.

The Bottom Line

UI tests have a reputation for being slow and brittle, but there are tools that can improve both shortcomings. Parallel testing is an easy way to dramatically cut down on testing time by simultaneously running tests. While it can be challenging to set up parallel testing environments, some platforms automate the process.

TestCompete provides a UI test automation platform that leverages AI-powered hybrid object recognition to make tests less brittle, as well as parallel testing to cut down on the time it takes to run tests. By aggregating reporting in a single place, it's easy to keep stakeholders on the same page and quickly troubleshoot any issues that arise.

Start a free trial today to see how easy it is to improve your UI tests today!