App & Browser Testing Made Easy

Give your users a seamless experience by testing on 3000+ real devices and browsers. Don't compromise with emulators and simulators

Home Guide How to perform Parallel Test Execution in Appium?

How to perform Parallel Test Execution in Appium?

By Hamid Akhtar, Community Contributor -

Mobile test automation is now almost exclusively associated with Appium. It is cross-platform, free, open-source, and can be used for native, hybrid, and web applications on Android and iOS. It can be installed on any operating system and works with many programming languages, such as Java, C#, Python, JavaScript, and many others.

As defined at, Appium is based on the notion that testing native apps shouldn’t require integrating an SDK or recompiling your app. And also, you should be able to use the frameworks, tools, and testing methods you are already familiar with. Most importantly, you can test the app you submit to the marketplace. With its standard automation specification and API, it’s easy to say that Appium is useful for apps that run on multiple platforms, like Windows, Android, or iOS.

Due to the growing competitiveness, a quicker time to market (TTM) has become crucial for any organization to compete in the market today. Resorting to parallel test execution with Appium is the overall result.

How does Appium Work?

With a REST API exposed, Appium is fundamentally a webserver. In a nutshell, it accepts connections from a client, listens to the commands, executes them on a mobile device, and returns an HTTP response that represents the result. Client/server architectures open up many possibilities: you can write your test code in any language with an HTTP client API, but Appium client libraries are more convenient.

  • Another significant aspect of Appium that may be discussed in this context is that you are not required to develop and execute your tests in a particular language or framework. 
  • This requirement is satisfied by the WebDriver API, which encapsulates the vendor-provided frameworks. 
  • WebDriver (aka “Selenium WebDriver”), defines a client-server protocol (known as the JSON Wire Protocol).
  • With the client-server architecture, a client created in any language can send HTTP requests to the server. Every major programming language already has clients written in it.
  • As a result, you can use any test framework and test runner. The client libraries are just HTTP clients, so you can include them in your code however you like.

That is to say, Appium and WebDriver clients are “automation libraries” rather than “test frameworks.” Any technique you choose can be used to manage your test environment. As for automating web browsers, WebDriver has taken over as the de facto standard.

Importance of  Parallel Testing

The goal of adopting enterprise test automation should always be to run a test script on as many devices as possible. It lets you run tests, get results, and fix problems with the app you’re making quickly. 

  • When you switch from sequential to parallel testing in your QA routine, the importance of parallel testing becomes easily apparent. 
  • Moreover, manually starting mobile tests that run device by device doesn’t fit well with agile thinking. 
  • Appium is about automating tests to run simultaneously on an unlimited number of real mobile devices. 
  • Simulators and emulators are severely constrained in handling real hardware specifics and the number of concurrent instances that can be launched.
  • Therefore, it is usually advisable to test on actual devices. 
  • You must cleverly configure the device with the Appium server so that it can recognize the device, as this will allow you to catch errors that you might not otherwise be able to identify.

Aside from that, Appium’s desired capabilities take into account a wide range of variables, such as the automation engine, the whole platform description (OS, version, etc.), the application (name/link, run details, timeouts), and several other variables related to launching, execution, or device sessions.

Advantages of Parallel Testing with Appium

To utilize the advantages of Parallel Testing with Appium and expedite execution times, independent tests can be run in parallel. In particular, as part of a CI/CD pipeline and DevOps methodology, IT businesses embrace continuous testing to boost software quality and velocity. Continuous testing, however, demands efficient and simplified test automation. 

  • The importance of parallel testing is further seen when mixed with the new continuous testing methodology, which enables broad test coverage in the shortest execution time possible. 
  • In contrast, Appium parallel execution on multiple devices speeds up testing and considerably lowers the risk of constant quality visibility by assisting you in removing the bottleneck.
  • Previously, it only tested iOS and Android mobile apps. However, Appium now offers an additional step that checks Windows desktop applications.

Pro-Tip: It is best to use a Parallel Test Calculator to understand the number of parallel sessions required to achieve test coverage and build execution time goals.

Performing Parallel Test Execution in Appium using TestNG

Appium parallel execution on multiple devices is an integral part of BrowserStack that lets you run the same test or several tests simultaneously on different devices and OS versions. Your test suite’s runtime will be reduced, leading to faster builds and release times.

  • For this, a BrowserStack username and access key are required. Your access credentials can be found in your account settings after you sign up.
  • Make sure your machine has Maven and Java 8+ installed.
  • You can upload your iOS app (.ipa file) or Android app (.apk or .aab file) to BrowserStack servers using our REST API. 

From the GitHub repository, clone the TestNG integration sample code.

git clone

Execute the subsequent commands to install the necessary dependencies:

# Test an android app
cd android/testng-examples
mvn clean

# Test an iOS app
cd ios/testng-examples
mvn clean

This will set up necessary dependencies, including the Java client library for Appium:


Configure Appium’s desired capabilities:app capability & device capability.

In the TestNG sample integration code, parallel.conf.json file located in testng-examples/src/test/resources/com/browserstack/run_parallel_test directory has the Appium’s desired capabilities defined.

To provide the list of devices for parallel test execution, multiple devices are listed in the environment’s key.

"server": "",
"username": "userid",
"access_key": "accesskey",

"capabilities": {
"project": "First TestNg Android Project",
"build": "TestNg Android Parallel",
"name": "parallel_test",
"browserstack.debug": true,
"app": "bs://<app-id>"
"environments": [
"device": "Google Pixel 3",
"os_version": "9.0"
"device": "Samsung Galaxy S10e",
"os_version": "9.0"
  • Using Capabilities Builder, you can investigate more Appium capabilities.
  • Once the needed features have been set up, you may initialize an Appium webdriver to do remote testing on BrowserStack. To achieve this, you must utilize a remote BrowserStack URL and your BrowserStack access credentials.

The remote Webdriver is initialized in the file found in the testng-examples/src/test/java/com/browserstack/run_parallel_test parallel test directory of the TestNG sample integration code, as shown below:

In the TestNG sample integration code, the remote Webdriver is initialized in the file found in the testng-examples/src/test/java/com/browserstack/run parallel test directory, as shown below:


// Initialize the remote Webdriver using BrowserStack remote URL access credentials
// and desired capabilities defined above
driver = new AndroidDriver (
new URL("http://"+username+":"+accessKey+"@"+config.get("server")+"/wd/hub"), capabilities


The following step will assist you in setting up a test case with the TestNG framework that will run concurrently on various devices.

Access this directory in testng-examples/src/test/java/com/browserstack/run_parallel_test for BrowserStack’s sample apps.

Please adjust the test case if you are testing your own app.

package com.browserstack.run_parallel_test;

// imports...

public class ParallelTest extends BrowserStackTestNGTest {
public void test() throws Exception {
AndroidElement searchElement = (AndroidElement) new WebDriverWait(driver, 30)
MobileBy.AccessibilityId("Search Wikipedia")));;

AndroidElement insertTextElement = (AndroidElement) new WebDriverWait(driver, 30)


List<AndroidElement> allProductsName = driver.findElementsByClassName(
Assert.assertTrue(allProductsName.size() > 0);

You may now run parallel tests on BrowserStack. Switch to the testng-examples/ directory in the TestNG sample integration code, then use the following command to run the test:

# Run using maven
mvn test -P parallel

On the App Automate dashboard or by using REST APIs, you can access the test execution results and debugging data such as video recording, network, and device logs.

Closing Notes

Deploying applications from conception to production without a hitch is feasible thanks to a cutting-edge methodology called DevOps for mobile app development. However, testing is far too often the bottleneck in DevOps. The entire cycle is held up by laborious testing. 

Parallel test execution in Appium solves this problem as it enables automated testing of native, hybrid, and mobile web apps and provides support for multiple programming languages. It truly empowers QA teams to test on multiple browsers, device,s and OS combinations without worrying about build times.

Try Parallel Testing

Automation Testing Parallel Testing

Featured Articles

How to run Appium Tests on macOS?

XPath in Appium: Tutorial

Curated for all your Testing Needs

Actionable Insights, Tips, & Tutorials delivered in your Inbox
By subscribing , you agree to our Privacy Policy.
thank you illustration

Thank you for Subscribing!

Expect a curated list of guides shortly.