Home > Enterprise >  jacocoTestReport always SKIPPED
jacocoTestReport always SKIPPED

Time:09-17

Expected Behavior

jacocoTestReport work

Current Behavior

jacocoTestReport SKIPPED

Context

I created a task whose type is Test, and jacocoTestReport depends on the task. When I ran the task, jacocoTestReport did not work and I got the following information

jacocoTestReport SKIPPED

I find if I use the task test directly, jacocoTestReport worked fine. It makes me confused

the following code caused the above issue

plugins {
    id 'java'
    id 'jacoco'
}

repositories {
    mavenCentral()
}

dependencies {

}

task myTest(type: Test) {
    useTestNG()
    useJUnitPlatform()

    finalizedBy jacocoTestReport
    reports {
        junitXml.required = false
        html.required = true
    }
    jacoco {
        enabled = true
        destinationFile = layout.buildDirectory.file("jacoco/${name}.exec").get().asFile
    }
}

jacocoTestReport {
    // tests are required to run before generating the report
    dependsOn myTest
    reports {
        xml.required = false
        csv.required = false
        html.outputLocation = layout.buildDirectory.dir('jacocoHtml')
    }

}

Steps to Reproduce

example project

Your Environment

Gradle 7.1.1

Thanks

CodePudding user response:

It is expected, not an issue. just because I use the jacocoTestReport in a wrong way

see https://github.com/gradle/gradle/issues/18271

  • Related