Skip to main content
Transform your testing process with: Real Device Features, Company-wide Licences, & App Percy
No Result Found
Get your setup working faster. Join our Discord for optimisation tips from elite testers. Join our DiscordJoin our Discord

Speed up your multi-module test executions

Run your multi-module tests on multiple device/OS combinations concurrently to reduce your testing time using parallel testing feature of BrowserStack App Automate.

Parallel testing on BrowserStack enables you to test at scale with the Espresso automation framework. Parallel testing reduces the overall test execution times, resulting in improved build times and faster releases.

For example, if your test suite takes 30 minutes to execute sequentially on a single device, you can test concurrently on multiple devices and still limit the build time to around 30 minutes. You can also split your test suite into six shards and execute them in parallel to bring down the build time on each device to as low as five minutes. This assumes all your test cases take about the same amount of time to run.

There are two key approaches to test in parallel on BrowserStack. You can combine both these approaches or use them individually.

  • Test concurrently on multiple devices.
  • Use the Test Sharding feature.

Test concurrently on multiple devices

Run your multi-module test suite concurrently on multiple Android devices to increase device coverage and testing velocity. Specify a list of supported Android devices to set the devices parameter in the REST API request to start your test execution. A new test build starts the execution of your multi-module test suite simultaneously on each of the specified devices.

REST API endpoint:

POST /app-automate/espresso/v2/module-build

Example cURL request:

curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \
-X POST "https://api-cloud.browserstack.com/app-automate/espresso/v2/module-build" \
-d '{"devices": ["Google Pixel 7-13.0", "Samsung Galaxy S10-9.0"], "testSuite": "bs://j3c874f21852ba57957a3fdc33f47514288c4ba4"}' \
-H "Content-Type: application/json"

In the above example, the test suite executes on Google Pixel 7-13.0 and Samsung Galaxy S10-9.0 devices in parallel. However, within each device, all the test cases execute sequentially. This blocks two parallel tests licenses in your App Automate subscription plan.

Use test sharding

Instead of running your test suite sequentially, you can split test cases into multiple shards and execute these shards in parallel. This is especially helpful when your test suite has a large number of test cases. To enable test sharding, pass the shards parameter in the REST API request to start Espresso test execution.

REST API endpoint:

POST /app-automate/espresso/v2/module-build

Example cURL request:

curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \
-X POST "https://api-cloud.browserstack.com/app-automate/espresso/v2/module-build" \
-d '{"shards": {"numberOfShards": 2} , "devices": ["Google Pixel 7-13.0"], "testSuite": "bs://j3c874f21852ba57957a3fdc33f47514288c4ba4"}' \
-H "Content-Type: application/json"

In this example, the test suite splits into two shards, and each shard executes in parallel on Google Pixel 7-13.0. This blocks two parallel tests licenses in your App Automate subscription plan. There are multiple strategies and options to configure test sharding behavior.

To know more, refer to Use test sharding documentation.

Combine both approaches

You can combine both approaches to use test sharding on multiple devices.

REST API endpoint:

POST /app-automate/espresso/v2/module-build

Example cURL request:

curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \
-X POST "https://api-cloud.browserstack.com/app-automate/espresso/v2/module-build" \
-d '{"shards": {"numberOfShards": 2} , "devices": ["Google Pixel 7-13.0", "Samsung Galaxy S10-9.0"], "testSuite": "bs://j3c874f21852ba57957a3fdc33f47514288c4ba4"}' \
-H "Content-Type: application/json"

In this example, the test suite splits into two shards, and both shards execute in parallel on Google Pixel 7-13.0 and Samsung Galaxy S10-9.0. This blocks four parallel tests licenses in your App Automate subscription plan.

You need to buy sufficient parallel tests licenses to test in parallel. If you trigger more tests than allowed in your App Automate subscription plan, they are either queued or discarded.

To monitor your parallels and queue usage, refer to our documentation on managing parallels and queues.

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 Check Circle