Skip to content

Jacoco integration test report xml not generating #119

@adispennette

Description

@adispennette

I have a multi module project using gradle kotlin DSL and I have configured the integration test set:

testSets {
        create("testIntegration") {
            dirName = "test-integration"
        }
    }

I have configured Jacoco:

jacoco {
        toolVersion = "0.8.6"
        reportsDir = file("$buildDir/reports/jacoco")
    }

    tasks.withType<JacocoReport> {
        afterEvaluate {
            classDirectories.setFrom(
                files(
                    classDirectories.files.map {
                        fileTree(it).apply {
                            val excludes: List<out String> = project.extra["excludes"] as List<out String>
                            exclude(excludes)
                        }
                    }
                )
            )
        }
        reports {
            xml.isEnabled = true
            csv.isEnabled = false
            html.destination = file("$buildDir/jacocoHtml")
        }
    }

but the only report that ever gets built is jacocoTestReport.xml
based on my configuration above I would expect an additional jacocoTestIntegrationReport.xml to be created as well.

I have tried a number of was to attempt to force it to generate the report but nothing seems to work.
In the sub-module I have added:

tasks.named<JacocoReport>("jacocoTestIntegrationReport") {
    val test = tasks.named<Test>("test")
    val testIntegration = tasks.named<Test>("testIntegration")
    executionData(test, testIntegration)
    reports {
        xml.isEnabled = true
        csv.isEnabled = false
        html.destination = file("$buildDir/jacocoHtml")
    }
}

Hoping that would do something but nothing is working.

It seems to me jacoco is working fine since it is outputting the junit test report but test-sets that is not properly providing the data for jacoco to generate a report.

I hope I am just missing something trivial but at this point I can not find it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions