Already for years, our Testdroid Run in Cloud Plugin has been instrumental for many mobile app and game developers to enable test automation with real mobile devices on the cloud. As a Jenkins user, Testdroiders have had a chance to launch their test runs from the the Jenkins jobs and results have been delivered back in minutes. This enablement has been a profound shift for many developers to jump on board with real agile workflow and make continuous integration work for building and automating tests.
Jenkins is no doubt the most popular CI software used among mobile developers. In order to make it easy and seamless for you to integrate your build and testing environment, you can download Testdroid Run in Cloud Plugin using the Jenkins Plugin Manager. Just search for “Testdroid” and select the plugin for installation. We recommend upgrading through the Jenkins Plugin Manager as there will be notifications on upgrades in the same place as well.
In case you are new to Jenkins or currently don’t have our Testdroid plugin in use, this blog will walk you through the installation steps and shows how to configure things with Testdroid Jenkins CI / continuous integration plugin for real devices. And this will only take few minutes!
Install and Configure Jenkins CI
Jenkins offers lots of great features out of the box, and many more can be added through additional plugins. There are variety of options for downloading and installing Jenkins:
- You can select of these platform-specific installers directly from the Jenkins site.
- You can also download jenkins.war directly from this link and launch it by executing the following command:
java -jar jenkins.war
- If you use containers that support JSP 2.0 or later, you can deploy this jenkins.war file the same way. Check more information about certain container-specific installation here.
Installation is easy, you don’t need additional tools to be installed, no database and Jenkins site have lots of different native packages and installers available.
Instructions for Testdroid Run in Cloud Plugin Configuration
Once you have Jenkins properly installed and used Plugin Manager to install Testdroid Run in Cloud Plugin, you can configure plugin with your credentials and preferences.
Click Manage Jenkins -> Configure System (on top of that list) and you’ll find a Testdroid Cloud section where you can enter your login credentials (email and password) and then press Authorize button to validate your account details and access. If you don’t have a valid Testdroid account, you can create it under testdroid.com or Testdroid Cloud.
How to Run In Cloud – Build Step(s) for Android and iOS
To get started you can open an existing Jenkins job or create a new one. From the Job Configuration -> Build select Run tests in Testdroid Cloud.
You can select your target project (you’ll see the list of your projects in the dropdown menu) and then give the name for your test run.
The next steps are the Application and Test where you specify the files that will be uploaded in Testdroid Cloud. If you need to further customize project settings click the “Edit project on Testdroid Cloud website” button and it will open Testdroid Cloud webpage with access to configure your project details.
As many applications today require additional data files you can use Data section to point the file (as a ZIP file) and when the test run is initiated the file gets automatically uploaded into Testdroid Cloud and resides under your project.
Scheduling of test runs can be set for parallel execution, consecutive execution or random execution. For a set devices to be used in test run, Device Group section provides list of all Device groups that you have defined in Testdroid Cloud. You can add, remove and configure your Device Groups in Testdroid Cloud and those are updated in this dropdown menu.
One great feature of test automation with Testdroid is that you can select what language will be devices set before the test session. Use Device Language section to determine what language will be preset before the test session.
Similar to Testdroid Cloud test launch wizard you can configure where captured screenshots will be stored. Also the test runner configuration is done here. For instance, if you use Google Espresso for Android app testing you should set android.support.test.runner.AndroidJUnitRunner here in Custom test runner section.
Furthermore, you can configure annotations in the following section. In this blog post the use of annotations is described in details and explained how to use annotations with Run In Cloud plugin to execute subsets of tests. The actual annotation information can be configured with the following section:
Notifications from Testdroid Cloud about Test Run
There’s two simple ways to get notifications from Testdroid Cloud that your test runs are finished. Whether you are running just on few devices or hundreds different devices simultaneously, both of these ways provide extremely easy and straightforward way to get results back to your Jenkins environment.
Jenkins is polling Testdroid Cloud for the results. Test results are fetched from Testdroid Cloud to Jenkins workspace after all your tests are finished.
Testdroid Cloud sends
post message to the specified URL when test run is finished. Testdroid Run in Cloud Plugin listens these messages in default location and then downloads results when
post message arrives. User can change the URL in the following section:
POST message body: testRunId=%s&projectId=%s&status=FINISHED
Note! This requires your HOOK URL is reachable from Internet e.g. Jenkins instance can be reached from Testdroid Cloud.
In addition to hook URL, you can set up specific folder where results and data will be stored, timeout for finalization message (timeout for results) as well as if you want to include screenshots and other graphical data from your test runs.
Happy Testing with Jenkins CI and Testdroid!