原创

Jacoco 覆盖率报告未生成

温馨提示:
本文最后更新于 2024年04月12日,已超过 37 天没有更新。若文章内的图片失效(无法正常加载),请留言反馈或直接联系我

I am attempting to generate a coverage report using jacoco so I can use the coverage gutters extension in VSCode. Although my coverage report is not being generated at all and all I have is an empty jacoco file in my build directory.

Below is my current build.gradle file:

plugins {
    id "application"
    id "jacoco"
}
apply plugin : "java" 
apply plugin: 'jacoco'

repositories {
    mavenCentral()
}


ext {
    javaMainClass = "hw6.LegoPaths"
}

application {
    mainClassName = javaMainClass
}

dependencies {
    testImplementation 'org.junit.jupiter:junit-jupiter:5.9.1'
    testImplementation 'org.hamcrest:hamcrest:2.2'
}

test {
    finalizedBy jacocoTestReport // report is always generated after tests run
}
jacocoTestReport {
    reports {
        xml.required = true
        csv.required = true
        html.outputLocation = layout.buildDirectory.dir('jacocoHtml')
    }
}

Tests run fine when I run ./gradlew test jacocoTestReport but no report is generated.

正文到此结束
热门推荐
本文目录