Anyone knows how to generate test report for gradle 1.12?
I'm using gradle 1.12. My Test extends ActivityInstrumentationTestCase2. using Espresso test framework. My test run but doesn't generate html report.
Here's my build.gradle:
apply plugin: 'com.android.application'
apply plugin: 'crashlytics'
repositories {
maven { url 'http://download.crashlytics.com/maven' }
maven { url 'http://JRAF.org/static/maven/2' }
jcenter()
}
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
...
}
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
def Properties versionProps = new Properties()
versionProps.load(new FileInputStream(file('version.properties')))
defaultConfig {
applicationId 'com.android.apps'
minSdkVersion 9
targetSdkVersion 20
versionName versionProps['name']
versionCode versionProps['code'].toInteger()
testApplicationId 'my.test'
testInstrumentationRunner 'com.google.android.apps.common.testing.testrunner.GoogleInstrumentationTestRunner'
}
android {
useOldManifestMerger true
}
packagingOptions {
exclude 'META-INF/services/javax.annotation.processing.Processor'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
lintOptions {
abortOnError false
}
productFlavors {
}
}
I run my test using shell script Here's my shell script:
# Clean and Build the project
gradle clean build
# Install apk to device
gradle installDebug installDebugTest
# Run specific test
/Applications/Android\ Studio.app/sdk/platform-tools/adb shell am instrument -e class my.test.RunTestSuite -w my.test/com.google.android.apps.common.testing.testrunner.GoogleInstrumentationTestRunner
The result in command prompt:
...
BUILD SUCCESSFUL
Total time: 55.003 secs
my.test.TestActionBar:.
Test results for GoogleInstrumentationTestRunner$BridgeTestRunner=.
Time: 32.519
OK (1 test)
If fail
Test results for GoogleInstrumentationTestRunner$BridgeTestRunner=.E
Time: 29.595
FAILURES!!!
Tests run: 1, Failures: 0, Errors: 1
See Gradle userguide by navigating to Example 23.14. Creating a unit test report for subprojects
Also see this post
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With