Native Android applications can be tested using Rainforest on Rainforest Virtual Machines and a real device. This article will walk through how testing on real Android devices works and how to set up your Android application for testing.
How testing works:
Android real devices, like their iOS counterparts, are sourced from Amazon device farm. However, Android real devices are accessed differently than iOS real devices as you no longer need to install the Rainforest framework to the app to test. All that is needed now is to properly configure your app and set up access.
With Android real devices it is possible to access the full phone functionality. In short, applications that are already pre-installed on the devices will be accessible for testing.
Setting up your app for testing on Android real devices:
1. Before accessing the Rainforest dashboard configure your app for testing on real devices:
When you compile your .apk file, make sure that it’s compiled for ARM, AND for x86. This will allow you to run your app seamlessly on our real devices. Once compiled upload your app .apk file to S3, FTP server, or any accessible web site so that Rainforest can access your app.
- If your app is compiled incorrectly, the app will not be present in the list of installed apps when the test starts.
2. Inside the Rainforest dashboard set up your native Android application for testing:
In the Rainforest UI navigate to the admin panel and select sites. Scroll down to the Apps section and below your current Apps select the Add App button. Name your application, input your URL and select the Android Real Device option.
- Rainforest will upload your application from this URL to our server and will set the site/environment of the test to this URL.
- Rainforest will automatically download and install your native Android application on real devices for testing.
- The link must lead to a direct download; avoid links that redirect, require credentials, or limit access.
After performing the steps above, your application will be ready to be tested by Rainforest!
Creating a new native Android test
- To create a new test for your Android application on real devices, click New Test, then select ‘New mobile test’
To set the app you wish to test, click the dropdown, and select the URL for the .apk (compiled for ARM and x86) file you wish to test
- Select the devices you wish to test from the Platforms section
- NOTE: As Rainforest will automatically download, install and start your application for testing, you cannot select non-android devices for this
Android tests on real devices will NOT start with the app preloaded! You must include a few steps at the beginning of the test to ensure that testers can open app properly to begin the test.
Feel free to use these sample steps in your test!
Look at the terminal.
Do you see an android phone interface?
Click on the Apps icon the bottom right side.
Do you see a list of apps?
Look for the ___your app name__ app in the list of apps. If necessary, check the second page of apps (swipe the screen right or click on the second small button in the bottom of the page).
Do you see the ______ app?
Click on the ______ app.
Does the app open correctly?
Running tests for Android on real devices:
Real Devices are limited in number by Amazon Device Farm, so these tests may take a few hours to complete (rather than 30 minutes), based on device availability. Most tests are executed within 5 hours, but on rare occasions, may take up to 24 hours.
Running tests from the API:
Follow the instructions provided here informing the browsers and app_source_url params:
- browsers: your selection
- app_source_url: the URL of your .apk file
Running tests from the CLI:
Be sure you have installed the latest version of our CLI. This is required to run Mobile tests: https://github.com/rainforestapp/rainforest-cli
Run your test passing the browser and app-source-url params:
- rainforest run --tag <your_test_tag> --token <your_token> --browsers *** --app-source-url <url_to_the_apk_file>
- Alternatively, instead of the URL, you can pass to the app-source-url the path for your .apk file.
Limitations of Android real devices:
There are some limitations to native Android testing. Please bear the following in mind when running these tests:
- Your native Android tests are run against Device Farm devices, which are limited in number. This means that run time is subject to individual device availability, and if a device is in high demand, you may experience some delay in run time.
- Most runs are completed successfully within a few hours. On rare occasions, runs may take up to 24 hours to complete.
- Your app WILL NOT start launched. You must tell the testers to open the app manually, according to the steps listed above
- Devices cannot make phone calls or send SMS messages
- Individual Mobile tests run for a maximum of 45 minutes; the test is aborted after this time. Keep your step counts to about 10 steps to ensure speedy testing!
- AWS devices use Wifi for connection, there is no supported use of 3G or 4G networks.
- You cannot access Google play for app downloads at this time.
If you have any questions about mobile app testing on Android real devices, let us know at firstname.lastname@example.org!