I execute the tests by 'gradle unitTest' and the output is put into build/reports/tests and build/test-results like normally in Gradle.
sourceSets {
test {
java.srcDir file('src/test/java')
resources.srcDir file('src/test/resources')
// Add test-dependencies to classpath
compileClasspath += configurations.testCompile
// Add our classes to classpath
compileClasspath += files("${buildDir}/intermediates/classes/plain/debug")
runtimeClasspath = output + compileClasspath
}
}
task unitTest(type: Test) {
testClassesDir = sourceSets.test.output.classesDir
classpath = sourceSets.test.runtimeClasspath
}
check.dependsOn unitTest
android.libraryVariants.all {
if (it.name.equals("plainDebug")) {
testClasses.dependsOn(it.javaCompile)
}
}
dependencies {
// compile time dependencies are left out in this example
testCompile('junit:junit:4.11')
testCompile 'com.squareup:fest-android:1.0.8'
testCompile 'org.mockito:mockito-core:1.9.5'
testCompile files(plugins.findPlugin('android-library').getBootClasspath()) // android jar
}
But you are having the same problem as robolectric users. The best I have been able to do was to manually modify the .iml files to include the source and the libraries folder to include the dependencies