Skip to content

ScoverageAggregate for different test #124

@aesteve

Description

@aesteve

Hi and sorry to create an issue, since it's more of a question than a proper issue, but how do you aggregate coverage when you have different test tasks?

I have a multi-project build.
Say I have two test tasks: test and integrationTest
Then I have (as you said): reportTestScoverage and reportIntegrationTestScoverage => perfect.
I tried aggregateScoverage: it's running both the test and integrationTest tasks, perfect.
But I'd need to have two different aggregateScoverage tasks, one for each test task.

I tried first:

        create<org.scoverage.ScoverageAggregate>("testCoverage") {
            dependsOn("reportTestScoverage")
        }

But it failed saying many properties were missing.

Thus I tried:

        create<org.scoverage.ScoverageAggregate>("testCoverage") {
            dependsOn("reportTestScoverage")
            coverageOutputCobertura.set(true)
            coverageOutputHTML.set(true)
            coverageOutputXML.set(true)
            deleteReportsOnAggregation.set(false)
            coverageDebug.set(false)
            reportDir.set(rootProject.buildDir.resolve("reports"))
        }

But this failed because ScoverageAggregate.runner is null.

So I finally got it working through:

        create<org.scoverage.ScoverageAggregate>("testCoverage") {
            dependsOn("reportTestScoverage")
            coverageOutputCobertura.set(true)
            coverageOutputHTML.set(true)
            coverageOutputXML.set(true)
            deleteReportsOnAggregation.set(false)
            coverageDebug.set(false)
            reportDir.set(rootProject.buildDir.resolve("reports"))
            runner = ScoverageRunner(project.configurations.scoverage.get())
        }

But it doesn't work, it only creates scoverage for the last subProject it builded.

Do you have any pointer? Thank you!

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