This section explains how to automate your instrumented tests from your Jenkins continuous integration server with Genymotion SaaS, using gmsaas
command line tool.
Prerequisite
- adb from Android SDK platform-tools
- gmsaas command line tool
Configuring a Jenkins job with gmsaas
- To configure the Jenkins job that will run your instrumented test, from Jenkins, go to menu Configure.
- In Source Code Management, enter the location of the application source code.
- From the Build section:
-
Add Execute shell to run commands and add the following commands:
<GMSAAS_PATH>/gmsaas auth login <EMAIL> <PASSWORD>
<GMSAAS_PATH>/gmsaas instances start <RECIPE_UUID> <NAME>
<GMSAAS_PATH>/gmsaas instances adbconnect <NAME> [--adb-serial-port <VALUE>]
Note
<GMSAAS_PATH>
is the location of gmsaas on your Jenkins,<EMAIL>
and<PASSWORD>
are the email and password of your Cloud account. This authenticates you to Genymotion SaaS.<RECIPE_UUID>
is the device recipe/template uuid (you can get all the recipes by using the command gmsaas recipes list) and<NAME>
is the name you wish to give to the instance.<NAME>
is only used as a tag - you should not use it to issue commands from gmsaas to an instance. Use the instance UUID instead.
- Add Invoke Gradle script to run your instrumented test.
- Tick Root Build Script Dir.
- To have more logs, in Switches, enter
--debug --stacktrace
- In Tasks, add
connectedAndroidTest
:
-
- From the Post Build section:
- Add Publish JUnit test result report & Publish HTML reports to get test reports:
- Add Execute a set of scripts to stop the device where the tests were run. In Build steps, add Execute shell section and add the following command:
<GMSAAS_PATH>/gmsaas instances stop <UUID>
where<UUID>
is the UUID of the virtual device you created (not the<NAME>
!).
- Add Publish JUnit test result report & Publish HTML reports to get test reports:
Running the builds
You can run the builds manually by clicking Build with Parameters or have it automatically built by configuring a scheduled build.
Viewing test reports
Once your tests have run, you can view your test reports from Test Report.