Our project is using Gradle 3.5, jacoco 0.8.1
It has 3 modules -- module-A, module-B and module-C, and its code coverage is 50%, 6% and 42% separately, and the code coverage for the whole project is 38%.
Now we want to use the current code coverage for the whole project as the threshold, that means if the code coverage of the whole project is less than 38%, the build will fail.
I tried the solution in Minimum code coverage threshold in Jacoco Gradle
jacocoTestCoverageVerification {
violationRules {
rule {
limit {
minimum = 0.38
}
}
}
but failed, it hints that module-B violates the rules, instruction covered ratio is 0.06, but expect is 0.38, seems it only suits for the module level, not the whole project level.
Also I tried to use element = 'GROUP', but seems no effect. (https://www.eclemma.org/jacoco/trunk/doc/api/org/jacoco/core/analysis/ICoverageNode.ElementType.html)
Anyone knows how to set the minimum code coverage threshold for the whole project and not for the module level?
thanks,
jacocoTestCoverageVerification { violationRules { rule { limit { minimum = 0.5 } } }
– zeroxin Jul 19 '18 at 10:09