Skip to main content

Speed up your tests with parallelization

BrowserStack supports running tests simultaneously across multiple device-OS combinations. This feature is called parallel testing. It provides the same benefits as running a multi-threaded application.


Common questions around parallel testing

What is parallel testing?

On BrowserStack, you can run multiple tests at the same time across various device, and OS combinations. This is called parallel testing. Parallel testing gives you the same benefits as running a multi-threaded application.

How do organizations benefit from running tests in parallel?

As software teams move towards the continuous integration and delivery (CI/CD) model, the pace of software delivery becomes crucial. With faster builds, you can:

  • Release faster and more frequently: Your customers don’t have to wait for that latest feature or bug fix.
  • Improve automation coverage without worrying about the wait time: You can automate more test cases without worrying about increasing your build time. It will help you improve automation coverage and reduce manual testing.
  • Reduce developer frustration with faster feedback loops: Waiting for a test run to complete can be frustrating at times. With faster builds, your developers can focus on writing code instead of waiting for builds to complete.

Best Practices to run tests in parallel

The biggest challenge for parallelizing tests is how to write the tests so that they are able to run at the same time without impacting each other and producing flaky results.

  1. Create independent tests: To run in parallel, your tests should be independent of each other. When the test cases are dependent, you have to run them in a particular order, and you won’t be able to achieve parallel execution. Your tests need to be self-contained. So, when you run any test, you don’t have to worry about the order in which you run your test suite, and they should be able to run in any order

  2. Manage test data: Ensure each test uses its own test data and doesn’t depend on data created from a previous test. Any test data which your test cases need should be independent. Either the data used by individual tests should be isolated or the data should be restored in same state as it was prior to any test run. Also, ensure test run updates don’t overwrite each other.

  3. Use Your Framework’s Built-In Functionality: If your framework supports parallel tests, you can tell the test framework how many parallel processes you want. The test runner will spawn a new thread for the number you specify. Test frameworks that support parallelization like this make it fairly easy to add parallel testing into your process.

  4. Start with fewer tests that are easy to isolate: Start with the tests that can be most easily converted to parallel, then adapting some or all of the remaining tests after your team has had time to adjust to the parallel testing environment. Once you have started to use parallel testing and have integrated it into your development process, it is easy to expand the quantity and scope of parallel tests as the need arises.

How does parallel testing work on BrowserStack?

Your App Automate plan supports running the number of parallel tests that you have purchased (5 during free trial). But with test queueing, you can send more parallel test requests to BrowserStack than your plan limit.

The following are the salient points for queueing your tests:

  • You can launch an additional number of parallel tests with different device configurations above your parallel limit that you have purchased.
  • The additional tests will be queued and they would run as and when your existing running tests complete their execution.
  • For instance, if you want to run 5 additional tests, apart from your subscribed limit of, say, 2 parallel tests, we will queue the additional 5 tests until one of the 2 initial tests finish, and a slot is available for execution.
  • With queuing, you don’t need to worry about managing your test pipeline - we automatically take care of scheduling and execution for you.
  • With this feature, BrowserStack accounts with 1-5 parallels, can queue 5 tests. And, accounts with more than 5 parallels will have a max queue length equal to the number of parallels purchased.
  • For example, if you have 2 parallel tests for your account, you can queue up to 5 more tests, but if you have 200 parallel tests, you can queue up to 200 more tests.

Understanding parallelization concepts

Here are some important concepts including parallel strategies for running cross-device tests on BrowserStack:

Basic parallelization

Basic parallelization involves running your entire test suite, from start to finish, (n) number of times, where (n) is the number of unique device combinations you want to test on.

This strategy is useful when your tests are not written in an atomic way, i.e. all or some test files have a dependency on previous tests to have completed and the order of the test cases has to be maintained.

Test Queuing

Once you reach your account’s limit for running parallel tests, subsequent requests will be queued based on your individual user queue limit. Every user has their own queue; whereas parallel limits are counted at the account/organization level.

Important: Queues are designed to handle scheduling for a short duration only. Tests will be dropped if they are in the queue for more than 15 mins.

Next Steps

Unleash the potential of all your parallels!
Time to try out the full potential of your BrowserStack account. Run your test suite using all parallel threads!

Setting up BrowserStack for multiple teams?
If you need further assistance, our Sales team will be glad to assist you.

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked






Thank you for your valuable feedback

Is this page helping you?

Yes
No

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked






Thank you for your valuable feedback!

Talk to an Expert
Download Copy