Skip to content

Instantly share code, notes, and snippets.

@romainpiel
Created March 8, 2016 18:10
Show Gist options
  • Save romainpiel/06aab39ac7c902c5d662 to your computer and use it in GitHub Desktop.
Save romainpiel/06aab39ac7c902c5d662 to your computer and use it in GitHub Desktop.
Start/stop genymotion devices just to run the tests
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.genymotion:plugin:1.0'
}
}
apply plugin: "genymotion"
if (project.hasProperty('devices')) {
String[] deviceArray = project.property('devices').tokenize(',')
genymotion {
devices {
if (deviceArray.contains('5.1.0')) {
"Google Nexus 5 - 5.1.0 - API 22 - 1080x1920" {
template "Google Nexus 5 - 5.1.0 - API 22 - 1080x1920"
deleteWhenFinish false
}
}
if (deviceArray.contains('4.1.1')) {
"Samsung Galaxy S3 - 4.1.1 - API 16 - 720x1280" {
template "Samsung Galaxy S3 - 4.1.1 - API 16 - 720x1280"
deleteWhenFinish false
}
}
}
config {
taskLaunch = "connectedDebugAndroidTest"
}
}
}

Both devices ("Google Nexus 5 - 5.1.0 - API 22 - 1080x1920" and "Samsung Galaxy S3 - 4.1.1 - API 16 - 720x1280") are set up with animations disabled. To automate the disable animations part, we could also use the method described there: https://gist.github.com/xrigau/11284124

Start tests on our 5.1.0 and 4.1.1 devices:

./gradlew connectedDebugAndroidTest -Pdevices=5.1.0,4.1.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment