Hi all, in Appium Parallel Testing | Wireless Mobile Device Farm article, I will explain to you how to set-up a wireless mobile device farm or in other terms mobile device lab and how to run your mobile tests on multiple mobile devices. I will use Appium Desktop 1.6.1, Selenium Grid 3.11.0 (3.8.1 has a bug and you can not transfer capabilities to the hub.), TestNG 6.14.3 (6.13.1 has a bug and it can not execute parallel tests.) So, Let’s get started!

If you are getting started to Appium, please check this article first. http://www.swtestacademy.com/appium-tutorial/

Appium Parallel Testing and Mobile Device Lab Architecture

We will have two devices, for each device, we will have Appium Servers. Also, we need to configure each device with a specific “.JSON” file. All nodes will be connected to Selenium Grid Hub. In our test code, our driver URL will be Hub’s URL. HUB will distribute all requests to the nodes/devices, get responses from nodes/devices and then send them to us.

Install Selenium Grid for Appium Parallel Testing

Selenium Grid is part of Selenium projects and it allows you to scale your tests by distributing them on several machines (parallel test execution). You will also run one Appium Server for each mobile device that you will connect to your mobile device farm. You can go and install Selenium Server Standalone 3.11.0 here. Save it into a folder such as “C:\Selenium\grid-mobile-work”.

Then, we need to configure our devices (nodes) configurations and capabilities. I will have Sony Xperia XA1 Ultra and LG G4 as a test device. Below, you can see their configuration and capabilities “.JSON” files.

  • deviceName should be our device’s adress (ip:port) pair. We will learn how to get this info. Now, you can leave it as empty.
  • platformName is “Android“.
  • browserName is “Android-LG-G4“. You can give any name you want.
  • platformVersion is “6.0“. You can find this info in your phone settings.
  • maxInstance is “1“. We have only one LG G4 test device.
  • url is “appium-ip:appium-port“. We will get this info when we start Appium server for this node/device.
  • host is “appium ip“.
  • port is “appium port“.
  • hubPort is “hub’s port“.
  • hubHost is “hub’s ip“.

Also, create a “starthub.bat” file and copy and paste below command for starting Selenium Grid’s hub.

java -jar selenium-server.jar -role hub

In the end, you will have following file structure.

Now, you can run the hub as shown below. You need to go to your selenium-server.jar directory and run the “starthub.bat”.

Now, we can connect our devices via WIFI for appium parallel testing.

Connect Your Devices via Wi-Fi (Wireless) to your PC

In order to connect your devices to your PC via Wi-Fi, you need to install Android Studio first. You can check these steps in this article. Now, you can connect one of your test devices with USB port of your PC and enable USB debugging option in Developer Settings of your mobile device. Then, open a command window and do the followings:

  • Type “adb devices” and hit enter to see connected device UDID. (The first devices UDID).
  • Type “adb tcpip 5656” to assign a port to your first device. (If you want, you can give another unassigned port number to your device.)
  • Then, unplug the first device and connect the second device via USB.
  • Then, type “adb tcpip 5657” to assign a port to your second device. (If you want, you can give another unassigned port number to your device.)
  • Unplug the second device.
  • Go to the settings of your devices and find their IP addresses.
    First Device: Sony Xperia assigned IP is
    Second Device: LG G4’s assigned IP is
  • Type “adb connect” to connect your device via wireless (Wi-Fi).
  • Type “adb connect” to connect your device via wireless (Wi-Fi).
  • Type again “adb devices” and see both your device UDID via USB and ip:port pair via Wireless.

Now, as you see above, our test devices are connected to our PC via Wi-Fi. Let’s go on with Appium Server Initializations.

Run Appium Desktop for Each Device

Now, you should open 2 Appium Desktop instance for appium parallel testing and do the following settings for each Appium instance:

  • Set an Appium port.
  • Set a device port.
  • Allow session-override to override halted sessions.

Set bootstrap port.

then hit Start Server and start both Appium servers.

Alternative Way | Appium with Node.js  (If you installed Appium Desktop, then skip this step)

You can also install Appium by using npm commands. In order to do this, you need to install Node.js first. In this article, you can learn how to install Node.js on Windows.

After this installation, you can install Appium’s latest version by typing below command on command prompt.

npm install -g appium

If you want to install a specific Apium version, you can type below command.

npm install appium@1.8.0

When you hit enter, Node will start to download and install Appium. Then, you can check the installation by typing following command.

appium -v

You can start appium server with our node configurations by using below commands.

appium –session-override –full-reset –nodeconfig C:\Selenium\grid-mobile-work\node-lg-g4.json –port 5001 –bootstrap-port 2252

Note: If you have MAC, then you should run the following command: 

/Applications/Appium.app/Contents/Resources/node/bin/node /Applications/Appium.app/Contents/Resources/node_modules/appium/build/lib/main.js –session-override –full-reset –nodeconfig C:\Selenium\grid-mobile-work\node-lg-g4.json –port 5001 –bootstrap-port 2252

  • –session-override to enable session override.
  • –full-reset to enable full reset on each test.
  • –nodeconfig node_device.json Specify the file node configurations here.
  • –port 5001 use the same port as specified on the file nodeconfig node_device.json.
  • –bootstrap-port 2252 assigns a bootstrap port.

Check the Grid Console for Appium Parallel Testing

After hub and node configurations and initializations, open a browser and write “”  and hit enter. You should see that each node is connected to the hub as shown below.

Parallel Mobile Appium Test Project with TestNG

Now, it is time to create a sample test automation project with TestNG. We should write this code in parallel test execution manner. We will use İsinOlsun application, and write a code for the following scenario:

  • Open the app.
  • Skip splash screen
  • Skip tutorial screen
  • Select “İs Ariyorum” (It means I am looking for a job.)
  • Then, accept notifications.
  • Then, click the second job in the job list.
  • Then, close the app.

It is a very basic scenario. Our main purpose is to set up our wireless device lab and run them in parallel. After this step, you can extend this project.

Project Structure


Please do not use TestNG 6.13.1 it has a problem with parallel test execution. I used TestNG 6.14.3, it worked well.



Splash Screen

Tutorial Screen

Selection Screen

Candidate Main Screen

Base Test

ThreadLocal Driver Class for Thread Safety

ApplyToJob Test Class

and that’s all! It is time to run our test! and Subscribe our Youtube Channel for the latest news!

Do you want to learn how to add Cucumber support in this framework?
Let’s check the below article!