Skip to content

Instantly share code, notes, and snippets.

@malmstein
Created November 6, 2013 15:35
Show Gist options
  • Save malmstein/7338115 to your computer and use it in GitHub Desktop.
Save malmstein/7338115 to your computer and use it in GitHub Desktop.
apply plugin: 'java'
apply plugin: "jacoco"
repositories {
mavenCentral()
}
dependencies {
testCompile project(':app')
testCompile project(":app").android.applicationVariants.toList().first().javaCompile.outputs.files
testCompile project(":app").android.applicationVariants.toList().first().javaCompile.classpath
testCompile files(project(":app").plugins.findPlugin("android").runtimeJarList)
testCompile 'com.google.android:android:4.0.1.2'
testCompile 'com.google.android:support-v4:r13.1'
testCompile 'org.mockito:mockito-core:1.9.5', 'org.easytesting:fest-assert-core:2.0M8'
testCompile group: 'junit', name: 'junit', version: '4.+'
testCompile 'org.robolectric:robolectric:2.0-alpha-2'
test {
inputs.files file("AndroidManifest.xml")
doFirst {
copy {
from project(":app").file("src/main/AndroidManifest.xml")
into projectDir
}
}
testLogging {
exceptionFormat = 'full'
}
afterTest { desc, result ->
println "Executing test ${desc.name} [${desc.className}] with result: ${result.resultType}"
}
doLast {
"open $buildDir/reports/tests/index.html".execute()
}
}
tasks.withType(Test) {
scanForTestClasses = false
include "**/*Should.class" // whatever Ant pattern matches your test class files
include "com.novoda.roboletric/*.class"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment