Parallel Testing using Appium with Devices connected via Wi-Fi

Appium is an open source tool for automating native, mobile web, and hybrid applications on iOS mobile, Android mobile and Windows desktop platforms. Appium is in fact, an HTTP Server that exposes a REST API which receives connections from a client, listens for commands, executes those commands on a mobile device, and responds with an HTTP response representing the result of the command execution.

One of the main advantages of Appium is that it is cross platform and same test script can be used for testing the application on multiple platforms or different versions of the same platform. Considering that a typical mobile test automation has to be performed in multiple platforms and devices, parallel test execution is an essential activity. The steps below describe how automated test execution can be performed in multiple Android devices in parallel.


1. USB debugging should be enabled in the target devices.

2. Appium server, Android SDK etc should be installed in our PC

Let’s find out the steps for connecting multiple devices via Android Debug Bridge (ADB) over Wi-Fi

Step 1: Open the ADB command line Utility

ADB is a command-line utility included with Android SDK. ADB can control your device over USB from a computer, copy files back and forth, install and uninstall apps, run shell commands etc. It is a communication interface between the Android phones and computer. The ADB command line tool can be accessed from the Android SDK folder (E.g.: C:\ …\AppData\Local\Android\Sdk\platform-tools). You can navigate to the folder & open the command prompt from there.

Step 2: Connect your device using the USB cable.

Step 3: Run the adb devices command in the command prompt and the device gets connected.

Note down your device Id or UDID from the listed devices.

We have connected our device to the computer and now let’s move the mobile app apk (of the app to be tested) to the device using the below steps.

Step 4: To install apk:

adb -s install

E.g.: adb -s 71a19ad605 install C:\installs\app.apk

You will get a success message if the installation is successful.

Step 5: Configure ADB for Wi-Fi

Ensure that both the devices & host computer are in the same Wi-Fi network and the device is getting listed in the adb CLI tools (as shown below)

Now we need to connect the devices with TCP/IP port 5555(Since ADB is listening on TCP port 5555) using the command

adb -s tcpip 5555

Step 6: you can disconnect the device from the USB cable and using the IP address of the device we can configure the ADB via Wi-Fi using the following command

adb connect

(To get the IP address of the phone, go to settings->Network&Internet->Select Wi-Fi->Settings->Advanced->IP Address)

Now you can execute ‘ adb devices’ command to see that your phone is connected via Wi-Fi. You can connect multiple devices for parallel execution like this.

Step 7: Let’s modify our Appium TestNG scripts for parallel execution

Assuming that you already have a TestNG maven project with the required dependencies for Appium. For executing the Appium tests, Appium servers needs to be up & running. Only one device can be connected to a single Appium server instance and hence multiple Appium servers connecting to different ports to be opened prior to the execution. This can be achieved via the below method which will open the Appium server at the starting of the execution.

IP & the port details are passed from the TestNG xml using the URL parameter. TestNG Xml is modified for the parallel execution as shown below, multiple device details & Appium server details are passed in the XML.

Inside the before method, desired capabilities are set by using the above set TestNG parameters. Using the startAppiumServer method, Appium server is started dynamically before the start of the execution.

You can have your device specific tests in the @Test method. Now we have connected multiple devices via Wi-Fi and configured our TestNG tests for parallel execution.

Leave a Reply

Your email address will not be published. Required fields are marked *