Я пытаюсь сделать сборку gradle с jacoco, но она не удалась, потому что охват ниже, чем "ожидалось".Но когда я открываю сгенерированный файл HTML, он на самом деле превышает мой установленный минимум.
Я пытался исключить больше файлов из анализа, но это не помогло.
jacoco {
toolVersion = "0.8.4"
// applyTo test
}
jacocoTestReport.dependsOn(test)
// this just ensures it runs with for build, but not for non-builds (like tests)
build {
finalizedBy jacocoTestReport
// this will do checks on the violations + fail build if there's too little coverage
finalizedBy jacocoTestCoverageVerification
}
jacocoTestReport {
reports {
csv.enabled false
xml.enabled false
html.enabled true
// setting the output location for html stuff
html.destination file("${buildDir}/reports/jacoco")
}
afterEvaluate {
classDirectories.setFrom(files(classDirectories.files.collect {
fileTree(dir: it, exclude: [...files...])
}))
}
}
jacocoTestCoverageVerification {
violationRules {
rule {
limit {
// % in decimal form for when build should fail
minimum = 0.75
}
}
}
}
То, что я получаю в своей сборке, гласит: коэффициент покрытия инструкций равен 0,74, но ожидаемый минимум составляет 0,75
Но, как вы можете видеть в https://i.imgur.com/MO2GMlK.png, это 80%.Почему это происходит?