Hi Billy, Thanks for you reply :)
my gradle.build for test module looks like below
apply plugin: 'com.android.application'
apply plugin: 'android'
apply plugin: 'jacoco'
android {
compileSdkVersion 15
buildToolsVersion "19.1.0"
defaultConfig {
applicationId "...."
minSdkVersion 9
targetSdkVersion 9
testApplicationId "test"
testInstrumentationRunner "android.test.InstrumentationTestRunner"
}
buildTypes {
debug {
testCoverageEnabled = true
}
}
}
dependencies {
compile project(':sdk')
}
jacoco {
toolVersion = "0.7.1.201405082137"
}
def coverageSourceDirs = [
'/src/main/'
]
task jacocoTestReport(type: JacocoReport) {
group = "Reporting"
description = "Generate Jacoco coverage reports after running tests."
reports {
xml.enabled = true
html.enabled = true
}
classDirectories = fileTree(
dir: 'sdk/build/intermediates/classes/debug',
excludes: ['**/R.class',
'**/R$*.class'
])
sourceDirectories = files(coverageSourceDirs)
executionData = files('/sdk/ooyalaCoreSDK/build/outputs/code-coverage/connected/
coverage.ec')
}
and for my src module I have applied jacoco plugin and enabled testCoverageEnabled.
1) gradle build, gradle assembleDebugTest and then gradlew createDebugCoverageReport jacocoTestReport - build the src files then run the test and collect coverage
2)yes after successful test run
3) I am not, but not sure how to specify and where to call that in jacocoTestReport. If you can explain a little or share an example for that it will be great
4)yes, I am creating task jacocoTestReport
5) no I get all the files just that I get zero as result of coverage.
I am not exactly sure how to specify jacoco there are my test and src files so that I collects the information.