How to Add A New Device to On-Premise or Cloud Device Farm


Dear Testdroiders,

Last month I covered few topics on how we’re running our device farm and in that blog I sidelined briefly the built-in monitoring that provides us vital element to ensure everything is working as expected and users can get the best customer experience through the service. As there are a myriad of moving components, attributes, that all must be maintained and checked whether everything is up in speed, we have to rely on our internal monitoring implementation to keep everyone up-to-date with the status. Actually, this is not whole lot different thing if you are running your own device farm with Testdroid Enterprise as the tool provides some neat capabilities for monitoring test runs, queues, devices, infrastructure, capacities and so forth.


In this blog I’ll be walking you through of one example that we do pretty much every day here at DevOps team: adding a new device to our device farm. This is pretty common procedure but I hope it will give some insights on how to do it, what things you should consider if you do it in your on premises device lab, and what things are specifically under monitoring for each device – 24 hours per day.

Adding a New Device in Device Farm

That may sound trivial, and it actually is. But still there are few things that must go right – or otherwise device can be flaky and highly unstable to its users. As we support Android and iOS devices, working with ADB and Xcode are naturally every-day-business for our devops team. In addition, there are different measures – and sometimes hurdles – with configuration we have to go through to enable new devices in our Testdroid Cloud. And the very same thing applies to Testdroid Enteprise as well.

Screen Shot 2016-02-23 at 10.40.38 AM

If you are not operating your own device farm you probably don’t get to see this view at all. This is the main admin view snapped from Testdroid Cloud that gets us to the core of running the entire device farm. From the system status through device configuration to basic communication of the status of device farm is something we can access through this view.

As there can be hundreds of test runs initiated just during one minute it’s very important to get instant understanding of performance capabilities, status of test runs, devices, clusters and other information that gets devops folks all possible details of misbehaviors, alerts and statuses of the system. Furthermore, this is the view where we control each test run and take measures if something doesn’t work as expected.

Screen Shot 2016-02-23 at 12.43.16 PM

The above view works for test runs but when we monitor status of each device we use our Device view. The important information for running and keeping these devices online is the status of power, in which cluster it is connected to, and when the device was last time seen. Furthermore, we can get exact numbers of the battery power/status, WiFi connection (disabled, enabled) and accounts connected to the device. The ‘healty’ status gives us vital information how has the last test runs finished and if something is failing, we can get exact output logs of runs, performance and other relevant data to fix the device to be online/working again.

Screen Shot 2016-02-23 at 12.51.29 PM

Okay, let’s take a look at the steps of how to add a new Android device in this kind of device farm.

Prerequisites to Prepare Android Device for Tests

Here is an example of check list we typically go through when adding a new Android device in our device farm. The very same instructions also work for on-premise device labs if you use Testdroid Enterprise. First, we’ll go through some basic procedures that are related to hardware and make sure that all relevant software is properly installed on that device.

  1. Set WiFi network.
  2. Add Google account to device. Remember to uncheck auto-sync for account.
  3. Install / Update Google Play Store to the latest version.
    • Without Google Play Store installed, device won’t have required services which could be critical for some of the testing scenarios.
    • Start Play Store once and check possible notifications. Typically there are few so check them and close the app.
  4. Install Google Play Services
    • Open Google Play Store and search “Google Play Services”
    • NOTE! Google Play Services are updated quite often. Without upgrading your device will get notifications about a need to upgrade Google Play Service
  5. (Optional) Install Google Play Games
    1. This is required if – for example – you are testing games or your app depends on it.
    2. Open Google Play Store, search “Google Play Games” and install it.
  6. Disable security checks for installing applications through USB connection.
    • Enter “Development options” on Device settings
    • Check “USB debugging”, “Stay awake” and “Allow mock location”
    • Uncheck “Verify apps over USB”
    • Enter “Security” on Device settings
    • Check “Unknown sources”
    • Uncheck “Verify apps” (This is not necessarily available with all versions of Android)
  7. Disable Screen Lock
    • Enter “Security” on Device settings
      • Go to “Screen lock” settings and select “None”
      • If this is not possible, you need to configure device to be unlocked from Device settings on Testdroid Admin pages.
  8. Set correct Date & Time to device
  9. Set all “Location Services” on
  10. Install Google Chrome Browser (Optional)
    • Install Google Chrome Browser, if your tests needs it
    • Sign in to Chrome browser to make it work robust on tests.
  11. Set Screen timeout to maximum value
    • Enter “Display -> Sleep” in Device settings
    • Select maximum timeout value for sleep.

Screen Shot 2016-02-23 at 1.02.51 PM

Connecting Android Device to device server (aka Device Cluster)

We’ve an ebook available on the physical setup of a device lab so check it out for more information about the different possibilities and features with servers and additional hardware.

  1. Connect the device to Device Server using USB cable.
    • Check possible “Trust” dialog
      • After first connection to Device Server Android device will show notification dialog about “Trust this computer”
    • Device should be available at Jenkins
      • Check “Android Devices” page from Device Server Jenkins
      • Connected Android device should be shown as “Online” state.
      • Install Testdroid Device Service (TDS) application to the device using Jenkins “install” option
  2. Configure new device on Testdroid Admin pages
      • Use device name to find correct device from Testdroid Admin page
      • Open Device page for the device
        • NOTE! Device item is specific for each physical device
        • Change device name to something you prefer
        • Select device init behaviour (SKIP / REBOOT / REBOOT_WITH_UNLOCK / UNLOCK ONLY).
        • Set labels for the device (If you have multiple similar devices, it is good idea to use specific identifier on the device name). In the following view, admin can add multiple tags for device that will be shown in the device view for all users. For example, if we upgrade Android OS version, we first do it manually on that device, then changing the tag in this view to reflect the correct OS version / API level:

    Screen Shot 2016-02-23 at 11.57.51 AM

    • Open Device Model page by clicking device model name on Device page
      • NOTE! Device Model (by default) will include all similar devices with same Android version.
      • Set image for the device model (This image will be displayed in Testdroid UI for this Device Model)
  3. Run the first test with new device
    • Create device group and select the new device to it.
    • Create new test run with some application & test you know will work
    • Check the results

After this we typically go through troubleshooting if results do not get automatically shown up in our system. Well, when working with physical real mobile devices, so many things can go wrong in initiation, running phase or communication and fetching results back to our servers. This is the next topic I’ll be blogging about so stay tuned and please let me know if you have any questions or topic you’d like to know more about.

Happy (Robust) Testing!

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.