Speed up your Espresso test executions
Run your Espresso tests on multiple device/OS combinations concurrently to reduce testing time using the Parallel Testing feature of BrowserStack App Automate.
Parallel Testing on BrowserStack lets you test at scale with the Espresso automation framework. It reduces your overall test execution time, resulting in faster builds and quicker releases.
For example, a test suite that takes 30 minutes to run sequentially on a single device can run on multiple devices at once, without increasing the total build time. You can also split the same suite into 6 shards to bring the per-device build time down to about 5 minutes. This assumes all your test cases take roughly the same time to run.
There are two key approaches to test in parallel on BrowserStack. You can use either approach individually or combine both:
- Test concurrently on multiple devices.
- Use test sharding.
Run your Espresso test suite concurrently on multiple Android devices to increase device coverage and testing velocity.
Specify a list of supported Android devices in the devices parameter of the REST API request that starts your test execution. A new build starts your Espresso test suite on each specified device at the same time.
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 7-13.0", "Samsung Galaxy S10e-9.0"], "app": "bs://f7c874f21852ba57957a3fdc33f47514288c4ba4", "testSuite": "bs://j3c874f21852ba57957a3fdc33f47514288c4ba4"}' \
-H "Content-Type: application/json"
In this example, the test suite runs on the Google Pixel 7-13.0 and Samsung Galaxy S10e-9.0 devices in parallel. Within each device, test cases still run sequentially. This example uses 2 parallel test licenses in your App Automate subscription plan.
Split your test suite into multiple shards and run them in parallel, instead of running the suite sequentially. This is especially useful for large test suites.
To enable test sharding, pass the shards parameter in the REST API request that starts your 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 7-13.0"], "app": "bs://f7c874f21852ba57957a3fdc33f47514288c4ba4", "testSuite": "bs://j3c874f21852ba57957a3fdc33f47514288c4ba4"}' \
-H "Content-Type: application/json"
In this example, the test suite splits into 2 shards, and each shard runs in parallel on the Google Pixel 7-13.0 device. This example uses 2 parallel test licenses in your App Automate subscription plan.
For more sharding strategies and configuration options, see the test sharding documentation.
Combine both the approaches
Combine both approaches to run sharded tests across multiple devices at the same time.
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 7-13.0", "Samsung Galaxy S10e-9.0"], "app": "bs://f7c874f21852ba57957a3fdc33f47514288c4ba4", "testSuite": "bs://j3c874f21852ba57957a3fdc33f47514288c4ba4"}' \
-H "Content-Type: application/json"
In this example, the test suite splits into 2 shards. Both shards run in parallel on the Google Pixel 7-13.0 and Samsung Galaxy S10e-9.0 devices. This example uses 4 parallel test licenses in your App Automate subscription plan.
You need sufficient parallel test licenses to test in parallel. If you trigger more tests than allowed in your App Automate subscription plan, they’re 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
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!