Hi all, 

I am trying to generate the code coverage for our android project. It 
comprises of both Unit test cases and Instrument Test Cases. But the 
coverage is generated only for Unit tests. 

In the html file, the Activity names are present, but the coverage is 
always zero. Could someone please help me figure out the issue, so that the 
UI test cases also reflect a coverage. 

Please find below the build.gradle implementation and gradle commands. 

'''
task jacocoTestReport(type: JacocoReport, dependsOn: ["testDebugUnitTest", 
"createDebugAndroidTestCoverageReport", "connectedAndroidTest"]) {
    group = "Reporting"
    description = "Generate Jacoco coverage reports"

    reports {
        xml.required = true
        html.required = true
    }

    def fileFilter = ['**/AndroidManifest.xml', '**/strings.xml', 
'**/*.xml', '**/*.json']
    def mainSrc = "${project.projectDir}"
    def kotlinTree = fileTree(dir: 
"$project.buildDir/tmp/kotlin-classes/debugUnitTest", excludes: fileFilter)
    def kotlinUITree = fileTree(dir: 
"$project.buildDir/tmp/kotlin-classes/debugAndroidTest", excludes: 
fileFilter)
    sourceDirectories.setFrom(files([mainSrc]))
    classDirectories.setFrom(files([kotlinTree, kotlinUITree]))
    executionData.setFrom(fileTree(dir: "$project.buildDir",
            includes: ['**/*.exec', '**/*.ec']
    ))
}
'''

gradlew connectedAndroidTest jacocoTestReport


Thank you in advance.

-- 
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/7a394686-dac9-4a54-a914-83da4541c3b3n%40googlegroups.com.

Reply via email to