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. 


On Thursday, March 5, 2015 at 4:32:25 PM UTC-8, [email protected] wrote:
> Hi, I am new to jacoco I have a multi module android project building with 
> gradle and want to collect code coverage, saw jacoco will help but my project 
> structure is like,
> 
> Module 1
> -src
> --main
> ---java
> ---res
> 
> Module 2
> -src
> --main
> ---java
> ---res
> 
> Module Test
> -src
> --main
> ---java
> ---res
> 
> when I try gradlew createDebugCoverageReport, it creates a report but an 
> empty one. Am not sure how to test my jacoco that my use test from Test 
> module and use src code from Module 1 and 2, if there is any tutorial to set 
> up multi module android project with gradle , jacoco, please let me know. 
> Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jacoco/016364e0-d24c-4179-80f5-6c880fc3b3f8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to