Skip to main content
Transform your testing process with: Real Device Features, Company-wide Licences, & App Percy

Get Started with Parallel Testing

Parallel testing on BrowserStack enables you to test at scale with the XCUITest 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 XCUI 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.

  1. Test concurrently on multiple devices.
  2. Use the Test Sharding feature.

Test concurrently on multiple devices

It’s very easy to run your XCUI test-suite concurrently on multiple iOS devices. This helps achieve increased device coverage and testing velocity. Specify a list of supported iOS 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 XCUI test-suite simultaneously on each of the specified devices.

REST API endpoint :

POST /app-automate/xcuitest/v2/build

Example cURL request:

curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \
-X POST "https://api-cloud.browserstack.com/app-automate/xcuitest/v2/build" \
-d '{"devices": ["iPhone X-11", "iPhone 8-12"], "app": "bs://f7c874f21852ba57957a3fdc33f47514288c4ba4", "testSuite": "bs://e994db8333e32a5863938666c3c3491e778352ff"}' \
-H "Content-Type: application/json"

In the above example, the test-suite will be executed on iPhone X-11 and iPhone 8-12 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 XCUI test execution.

REST API endpoint :

POST /app-automate/xcuitest/v2/build

Example cURL request:

curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \
-X POST "https://api-cloud.browserstack.com/app-automate/xcuitest/v2/build" \
-d '{"shards": {"numberOfShards": 2, "mapping": [{"name": "Shard 1", "strategy": "only-testing", "values": ["SampleXCUITests/testAlert", "SampleXCUITests/testText"]}, {"name": "Shard 2", "strategy": "only-testing", "values": ["SampleXCUITests/testLogin"]}]}, "devices": ["iPhone X-11"], "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 iPhone X-11. 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/xcuitest/v2/build

Example cURL request:

curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \
-X POST "https://api-cloud.browserstack.com/app-automate/xcuitest/v2/build" \
-d '{"shards": {"numberOfShards": 2, "mapping": [{"name": "Shard 1", "strategy": "only-testing", "values": ["SampleXCUITests/testAlert", "SampleXCUITests/testText"]}, {"name": "Shard 2", "strategy": "only-testing", "values": ["SampleXCUITests/testLogin"]}]}, "devices": ["iPhone X-11", "iPhone 8-12"], "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 iPhone X-11 and iPhone 8-12. This will block 4 parallel tests licenses in your App Automate subscription plan.

Note: You will 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 will either be queued or discarded.

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