How to run parallel tests with Appium on Android using Genymotion Cloud (SaaS)

Genymotion Cloud hosts cloud-based Android emulators running in a SaaS fashion or as virtual images on AWS, GCP or Alibaba Cloud (PaaS). In this article, we will focus on SaaS. This allows you to test your applications using multiple device versions ( Android 4.1 to Android 8.0).

Launching automated tests can take a long time, so with this tutorial, you will learn how to parallelize your tests in order to detect bugs as soon as possible and spend less time on your test runs.


We’ve used Python throughout this tutorial but you can use your desired language; simply refer to the Appium documentation for Appium clients written in other languages.

Launch several devices in Genymotion Cloud

This step will create and launch several Genymotion devices

gmtool --cloud admin startdisposable "Google Nexus 5X - 8.0 - API 26 - 1080x1920" device_8.0 &
gmtool --cloud admin startdisposable "Google Nexus 6P - 7.1.0 - API 25 - 1440x2560" device_7.1 &
gmtool --cloud admin startdisposable "Google Nexus 6 - 7.0.0 - API 24 - 1440x2560" device_7.0 &

An adb tunnel will be set up once the devices are started, and the devices in the cloud will be seen as local devices. So you will be able to see your devices with the adb devices command :

> adb devices
List of devices attached
localhost:44953 device
localhost:34295 device
localhost:44497 device

Keep the port numbers handy, as you will need them to configure the Appium server.

If you need a persistent adb port, you can add the parameter --adb-serial portto the gmtool command:

gmtool --cloud admin startdisposable "Google Nexus 6 - 7.0.0 - API 24 - 1440x2560" device_7.0 --adb-serial-port 32123

The device will now be displayed as localhost:32123 device in adb devices command.

Start appium server

Since Appium 1.7, it’s easy to do parallel testing using only one appium server. Before that, we had to start N appium servers in order to test N devices in parallel.

So let’s start an Appium server, simply using the basic command:


Write your tests in Python

(Again, we’ve used Python throughout this tutorial but you can use your desired language.)

We’ve chosen to use Pytest as our test framework. It has several useful plugins like:

  • xdist: for running tests in parallel.
  • rerunfailures: for rerunning failed tests an arbitrary number of times to reduce build failures due to flakey tests

Here is a simple python script:

How to run Python tests in parallel

Now it’s time to run tests on all devices!

If we run the python script as follows:


pytest will execute tests on one device at a time. This is not what we want. In order to have results as soon as possible, we need to execute all the tests at the same time. To do that, we can take advantage of the pytest-xdist plugin and run the following command :

pytest -n 3
  • -n : number of worker processes you want to use. Here we start the suite with 3 processes

That’s it! You’ve been able to run parallel tests on several Genymotion Cloud SaaS virtual devices using appium and pytest.

If you also want to run on PaaS devices, it is easy, just start and stop the devices using the other providers tools (i.e EC2 APIs/CLI for AWS). You can also refer to tutorials for the setup.

Many thanks to Jonathan Lipps, one of the Appium maintainers and founder of Cloud Grey, for reviewing the article!

To learn more about Genymotion Cloud see the following resources :

To run parallelize your tests using Java rather than Python, see Ellinor Kwok project on Github.