https://kotlinlang.org logo
Title
b

Bernhard

10/25/2019, 2:05 PM
the jacoco task attaches itself to test by default but getting it to run for a custom tasks is neigh impossible
t

Thiago Nerys

10/25/2019, 2:12 PM
tasks {
    "test"(Test::class) {
        useJUnitPlatform()
        testLogging {
            events("PASSED", "FAILED", "SKIPPED")
            exceptionFormat = TestExceptionFormat.FULL
        }
        finalizedBy(jacocoTestReport)
    }
}
b

Bernhard

10/25/2019, 2:12 PM
yeah, that
doesn't work if your task is not named "test"
that just allows you to omit jacocoTestReport when running ./gradlew test
try to get this running for this example
task<Test>("integrationTest") {
    description = "Runs integration tests"
    useJUnitPlatform {
        includeTags("integration")
    }
    testLogging {
        exceptionFormat = TestExceptionFormat.FULL
    }
}
running ./gradlew integrationTest jacocoTestReport will never generate code coverage
p

pg

10/25/2019, 3:00 PM
Have you tried 'jacocoTestReport.shouldRunAfter integrationTest' ?