repositories { maven { url 'https://dl.bintray.com/alexeydanilov/maven' } } apply plugin: 'com.android.application' android { compileSdkVersion 23 buildToolsVersion '25.0.2' defaultConfig { applicationId 'com.danikula.proxycache.test' minSdkVersion 16 targetSdkVersion 23 versionCode 1 versionName '0.1' } compileOptions { sourceCompatibility JavaVersion.VERSION_1_7 targetCompatibility JavaVersion.VERSION_1_7 } } // temporary workaround for Robolectric issue https://github.com/robolectric/robolectric/issues/2647 android.applicationVariants.all { variant -> def productFlavor = variant.productFlavors[0] != null ? "${variant.productFlavors[0].name.capitalize()}" : "" def buildType = "${variant.buildType.name.capitalize()}" tasks["compile${productFlavor}${buildType}UnitTestSources"].dependsOn(tasks["merge${productFlavor}${buildType}Assets"]) } // display test progress http://stackoverflow.com/a/36130467/999458 tasks.withType(Test) { testLogging { // set options for log level LIFECYCLE events "passed", "skipped", "failed", "standardOut" showExceptions true exceptionFormat "full" showCauses true showStackTraces true // set options for log level DEBUG and INFO debug { events "started", "passed", "skipped", "failed", "standardOut", "standardError" exceptionFormat "full" } info.events = debug.events info.exceptionFormat = debug.exceptionFormat afterSuite { desc, result -> if (!desc.parent) { // will match the outermost suite def output = "Results: ${result.resultType} (${result.testCount} tests, ${result.successfulTestCount} successes, ${result.failedTestCount} failures, ${result.skippedTestCount} skipped)" def startItem = '| ', endItem = ' |' def repeatLength = startItem.length() + output.length() + endItem.length() println('\n' + ('-' * repeatLength) + '\n' + startItem + output + endItem + '\n' + ('-' * repeatLength)) } } } } dependencies { compile project(':library') testCompile 'org.slf4j:slf4j-simple:1.7.21' testCompile 'junit:junit:4.12' testCompile 'org.robolectric:robolectric:3.3.2' testCompile 'com.squareup:fest-android:1.0.0' testCompile 'com.google.guava:guava-jdk5:17.0' testCompile('com.danikula:android-garden:2.1.4') { exclude group: 'com.google.android' } testCompile 'org.mockito:mockito-all:1.9.5' }