In this chapter, you’ll learn how to instrument an Android app.
For Android developers: As part of the instrumentation process, the app will be compiled with the Ranorex automation library. This library adds additional functions and permissions to your APK. This is why we recommend you do NOT publish instrumented apps to Google Play.
In this chapter
Before you can instrument and deploy an app for automation with Ranorex, complete the following preparations:
Prepare the app
Make sure you can access the APK from the computer on which Ranorex Studio is installed. We recommend that you store a copy of the APK in a folder on that computer.
Prepare the mobile device
You can instrument and then immediately deploy the app to your mobile device with the Instrumentation Wizard. If you want to do so, you must connect the mobile device to your computer via USB (recommended).
For our example, we’ll instrument the Dropbox app. The app is a product of Dropbox, Inc, whose terms and conditions for downloading and using the app apply.
In preparation for instrumentation, we’ve stored the app in the folder Android app testing on the computer Ranorex Studio is installed on.
Start the Instrumentation Wizard and confirm the Windows security dialog.
Specify APK and settings
Browse to the folder that contains the APK.
The APK appears in the Instrumentation Wizard.
Click Settings… if you want to apply special settings.
Default settings for deploying the app after instrumentation.
Select mobile device
Select a mobile device from the list of available devices or
Open the endpoint list to select a mobile device.
Start instrumentation and deployment
Click Next > to start the instrumentation process.
Watch it progress. It can take several minutes.
If the process fails, please first check you’ve applied the ⇢ device settings correctly and ⇢ connected the device properly. A common problem is also that another program is consuming too many resources, slowing down instrumentation to the point of a timeout error. Either close all other programs or increase the Instrumentation timeout in the settings.
If the app has been instrumented and deployed correctly, you will see the following on your device:
The instrumented app appears in the Ranorex Service App.
The instrumented app appears on your device’s homescreen.
In Ranorex Studio, you can see the app has been instrumented correctly if it appears for selection when creating a mobile test.