The feature is now available. You simply need to apply the Gradle JaCoCo plugin and define coverage verification like this:
apply plugin: 'jacoco'
jacocoTestCoverageVerification {
violationRules {
rule {
limit {
minimum = 0.7
}
}
}
}
// to run coverage verification during the build (and fail when appropriate)
check.dependsOn jacocoTestCoverageVerification
The last line is very important as your build would otherwise not fail unless you explicitly run the jacocoTestCoverageVerification
task.
More information on the kind of checks you may add is in the documentation of the plugin.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…