Skip to content

Instantly share code, notes, and snippets.

@leonschreuder
Last active August 29, 2015 14:15
Show Gist options
  • Save leonschreuder/3f222f8687073c46cd64 to your computer and use it in GitHub Desktop.
Save leonschreuder/3f222f8687073c46cd64 to your computer and use it in GitHub Desktop.
Robolectric test specification from the commandline:
// Add test classes on the command line. Examples:
// gradle test -Dclasses=SomeClassTest // runs test/java/com/bla/SomeClassTest.java
// gradle test -Dclasses=*ActivityTest // runs all classes who's name ends in ActivityTest.java
// gradle test || gradle test -DClasses=all // both notations include all classes
def suppliedClasses = System.getProperty('classes', 'all')
if (suppliedClasses == 'all') {
println "target: all"
include '**/*Test.class'
} else {
def targetClass = '**/'+suppliedClasses +'.class'
println "target: " + targetClass
include targetClass
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment