Last active
August 29, 2015 14:21
-
-
Save up1/04839d24d9edc63e23e3 to your computer and use it in GitHub Desktop.
Android Code Coverage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
android { | |
... | |
buildTypes { | |
... | |
debug { | |
debuggable true | |
testCoverageEnabled = true | |
} | |
} | |
.... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
apply plugin: 'jacoco' | |
jacoco { | |
toolVersion = "0.7.1.201405082137" | |
} | |
def coverageSourceDirs = [ | |
'../app/src/main/java' | |
] | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
task jacocoTestReport(type:JacocoReport, dependsOn: "testDebug") { | |
group = "Reporting" | |
description = "Generate Jacoco coverage reports" | |
classDirectories = fileTree( | |
dir: '../app/build/intermediates/classes/debug', | |
excludes: ['**/R.class', | |
'**/R$*.class', | |
'**/*$ViewInjector*.*', | |
'**/BuildConfig.*', | |
'**/Manifest*.*'] | |
) | |
additionalSourceDirs = files(coverageSourceDirs) | |
sourceDirectories = files(coverageSourceDirs) | |
executionData = files('../app/build/jacoco/testDebug.exec') | |
reports { | |
xml.enabled = true | |
html.enabled = true | |
} | |
} | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MacBook-Pro:TemperatureConvertor somkiat$ ./gradlew jacocoTestReport | |
:app:preBuild UP-TO-DATE | |
:app:preDebugBuild UP-TO-DATE | |
:app:checkDebugManifest | |
:app:prepareDebugDependencies | |
:app:compileDebugAidl UP-TO-DATE | |
:app:compileDebugRenderscript UP-TO-DATE | |
:app:generateDebugBuildConfig UP-TO-DATE | |
:app:generateDebugAssets UP-TO-DATE | |
:app:mergeDebugAssets UP-TO-DATE | |
:app:generateDebugResValues UP-TO-DATE | |
:app:generateDebugResources UP-TO-DATE | |
:app:mergeDebugResources UP-TO-DATE | |
:app:processDebugManifest UP-TO-DATE | |
:app:processDebugResources UP-TO-DATE | |
:app:generateDebugSources UP-TO-DATE | |
:app:processDebugJavaRes UP-TO-DATE | |
:app:compileDebugJava UP-TO-DATE | |
:app:preCompileDebugUnitTestJava | |
:app:preDebugUnitTestBuild UP-TO-DATE | |
:app:prepareDebugUnitTestDependencies | |
:app:processDebugUnitTestJavaRes UP-TO-DATE | |
:app:compileDebugUnitTestJava UP-TO-DATE | |
:app:compileDebugUnitTestSources UP-TO-DATE | |
:app:mockableAndroidJar UP-TO-DATE | |
:app:assembleDebugUnitTest UP-TO-DATE | |
:app:testDebug UP-TO-DATE | |
:app:jacocoTestReport | |
BUILD SUCCESSFUL | |
Total time: 12.355 secs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment