Greetings all,
I am trying to have a code minimum coverage rule for jacoco plugin for all the code coverage which I am able to get working. I want to add a second rule to limit specifically according by class a list of classes in which I want code coverage to be different % than the overall coverage. So the first coverage is 60% and the second for selected classes I want to be 100%.
The problem I run into is that since the group of classes does not all have 100% code coverage shouldn’t it fail the build since I have the depends on setup to fail the build if the criteria in rules isn’t met? To clarify the overall current code coverage is slightly above 60% so the overall coverage should and does pass. The second rule shouldn’t pass because it requires 100% and there is not 100% current coverage.
Or am I misunderstanding how this plugin config should behave?
I saw a similar article but I am new and I wasn’t sure if I was allowed to ask a question off an existing post.
Please reference: Jacoco global default thresholds / local modifications setup
Please note that I have included about 20 classes but removed the names for security reasons. I also tried removing the regex and doing the package format instead of the path format and both passed the build and didn’t seem to make a difference. I am using Jacoco version 0.8.2 and gradle 1.0.0.
Please see below code:
violationRules {
rule {
limit {
minimum = 0.6 //Total code coverage percentage
}
}
rule {
enabled = false
element = 'CLASS'
includes = ['com.myclass.*']
limit {
minimum = 1.0 //code coverage for the included classes above
}
}
}
}
check.dependsOn jacocoTestCoverageVerification
test.finalizedBy(project.jacocoTestReport)```