Get started with Parallel Testing
Parallel testing on BrowserStack enables you to test at scale with the Espresso automation framework. Parallel testing enables you to reduce the overall test execution times, resulting in improved build times and faster releases.
For example, if your Espresso 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 6 shards and execute them in parallel to bring down the build time on each device to as low as 5 minutes (of course, this is based on the assumption that all your test cases take more or less the same time).
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
It’s very easy to run your Espresso test-suite concurrently on multiple Android devices. This helps achieve increased 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 will start the execution of your Espresso test-suite simultaneously on each of the specified devices.
REST API endpoint :
POST /app-automate/espresso/v2/build
Example cURL
request:
curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \
-X POST "https://api-cloud.browserstack.com/app-automate/espresso/v2/build" \
-d '{"devices": ["Google Pixel 3-9.0", "Samsung Galaxy S10e-9.0"], "app": "bs://f7c874f21852ba57957a3fdc33f47514288c4ba4", "testSuite": "bs://j3c874f21852ba57957a3fdc33f47514288c4ba4"}' \
-H "Content-Type: application/json"
In the above example, the test-suite will be executed on Google Pixel 3-9.0 and Samsung Galaxy S10e-9.0 devices in parallel. However, within each device, all the test cases will execute sequentially. This will block 2 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, you need to pass the shards
parameter in the REST API request to start Espresso test execution.
REST API endpoint :
POST /app-automate/espresso/v2/build
Example cURL
request:
curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \
-X POST "https://api-cloud.browserstack.com/app-automate/espresso/v2/build" \
-d '{"shards": {"numberOfShards": 2} , "devices": ["Google Pixel 3-9.0"], "app": "bs://f7c874f21852ba57957a3fdc33f47514288c4ba4", "testSuite": "bs://j3c874f21852ba57957a3fdc33f47514288c4ba4"}' \
-H "Content-Type: application/json"
In this example, the test-suite will be split into 2 shards, and each of those shards will execute in parallel on Google Pixel 3-9.0. This will block 2 parallel tests licenses in your App Automate subscription plan. There are multiple strategies and options to configure test sharding behaviour. To know more, refer to Use test sharding documentation.
Combine both the approaches
You can combine both the approaches to use test sharding on multiple devices.
REST API endpoint :
POST /app-automate/espresso/v2/build
Example cURL
request:
curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \
-X POST "https://api-cloud.browserstack.com/app-automate/espresso/v2/build" \
-d '{"shards": {"numberOfShards": 2} , "devices": ["Google Pixel 3-9.0", "Samsung Galaxy S10e-9.0"], "app": "bs://f7c874f21852ba57957a3fdc33f47514288c4ba4", "testSuite": "bs://j3c874f21852ba57957a3fdc33f47514288c4ba4"}' \
-H "Content-Type: application/json"
In this example, the test-suite will be split into 2 shards, and both the shards will execute in parallel on Google Pixel 3-9.0 and Samsung Galaxy S10e-9.0. This will block 4 parallel tests licenses in your App Automate subscription plan.
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
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!