Android tests on cloud virtual devices
When developing an Android application, testing is important; you want to test your application very often and cover most of the Android versions, screen sizes, etc…
But this is hard to do in real life. You are limited in the number of devices you can plug to your continuous integration server and you can’t really launch a bunch of emulators locally because your server does not have any UI and/or it is limited in terms of CPU and memory.
This is where Genymotion Cloud comes into play
Genymotion Cloud allows you to scale your tests and access live Android virtual devices from anywhere (if you don’t have Genymotion Cloud yet, well it’s never too late!)
In this post we’re going to see how to perform Android tests on Genymotion Cloud with the Genymotion Gradle plugin.
Configure build.gradle
1. First things first, head up to your build.gradle file
2. Edit the dependency block as below
buildscript {
dependencies {
classpath 'com.genymotion:plugin:1.4'
}
}
3. Apply the plugins by adding apply
apply plugin: 'genymotion'
4. Choose which Genymotion Cloud virtual devices will be used for your tests
genymotion {
cloudDevices {
nexus5 {
template "Google Nexus 5–5.1.0 — API 22–1080x1920"
}
nexus7 {
template "Google Nexus 7–4.3 — API 18–800x1280
}
}
}
5. Run your tests and Genymotion virtual devices will be started on the cloud and your tests will run on them!
If you are using Docker on your CI, learn how to configure your image to add Genymotion Cloud tools in it:
The plugin is open source and you can also find the documentation here.
Thanks Ellinor Kwok for all the content! If you want to go further read her article about Android tests and Genymotion cloud with test sharding.