Use Bitrise with Genymotion SaaS

2024-04-23

> Note: This article is a reproduction of a medium article: by Thomas Carpentier.

Mobile DevOps encourages the use of multiple mobile devices in the Cloud to tackle the challenge of performing quick and efficient tests in a highly Android dominant fragmented mobile market.

enables QA engineers to spawn many Android virtual devices in the Cloud in parallel and test at scale. is a Continuous Integration & Delivery platform dedicated to mobile apps.

Bitrise uses a powerful UI to create workflows easily.

Bitrise workflows can build, test, and deploy an app.

Genymotion SaaS is now available on .

QA engineers can choose Genymotion SaaS Android virtual devices to run tests on them using any testing framework.

The page lists Espresso and Appium as examples of supported testing frameworks.

The page states that there is no need to learn how to use the Genymotion SaaS command-line tool to automate the start/stop of the devices.

The start/stop automation can be handled in the UI.

This article covers Appium written tests.

Connect your Android project to Bitrise

Adding an application to Bitrise is simple.

The page directs readers to the for details.

After connecting an Android application to bitrise.io, a workflow is created with several default Android steps.

The following screenshot shows the default workflow.

Build an Android application

To run Appium tests, build an Android application.

Add the “Android build” step to the workflow.

When the “Android build” step executes, the APK path is pushed to an environment variable ($BITRISE_APK_PATH).

The workflow uses $BITRISE_APK_PATH later when running the tests.

Install and start an Appium server

Use the “Script” step to install and start an Appium server.

The page states that the “Script” step is a Bash script.

The “Script” step starts an Appium server with the needed capabilities.

The “Script” step arguments are described .

Add Genymotion SaaS start instances step

This step starts one or several devices on the .

This step has several required parameters.

Run tests

This tutorial uses an Android application with Appium tests written in Python.

The source code is public and available on .

Even if a different language is used, the logic is the same.

The workflow adds another “Script” step.

The “Script” step installs all dependencies.

The “Script” step starts the command executing tests.

The workflow uses the environment variable $BITRISE_APK_PATH which was exported in the Android build step.

The following script is used to install and start the Appium server.

| | #!/usr/bin/env bash | | --- | --- | | | # fail if any commands fails | | | set -e | | | # debug log | | | set -x | | | | | | #export JAVA_HOME | | | export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 | | | export PATH=$PATH:$JAVA_HOME/bin | | | | | | npm install -g appium --unsafe-perm=true --allow-root | | | | | | appium &>/dev/null & |

The following script is used to run tests.

| | #! /usr/bin/env bash | | --- | --- | | | # fail if any commands fails | | | set -e | | | | | | # debug log | | | set -x | | | | | | | echo " # Install dependencies " | | | pip3 install -r appium/requirements.txt | | | | | | # Execute tests through pytest | | | echo " # Execute tests " | | | pytest -n 2 appium/test_send_message.py --apk $BITRISE_APK_PATH |

Add Genymotion SaaS stop instances step

This step stops all Genymotion SaaS instances started in the “start” step.

This step always runs to make sure that no instances are left running in case a previous step fails the build.

No need to change the input variable “Instance UUID”.

The page states that “Instance UUID” is automatically exported in the “start” step.

Conclusion

At the end of this tutorial, a complete Continuous Integration workflow for an application should be possible.

The workflow includes unit and UI testing.

The page suggests improving the workflow by adding other steps in order to deliver the application.

More information is available .

If any questions exist, the page says to submit a request from the .

For more information, the page directs readers to .

Genymotion SaaS steps are open-source.

The page says to feel free to create an issue or contribute.

The Android application code sample used in this tutorial is available on .

Enjoy a Bitrise CI/CD workflow with Genymotion SaaS.