I want my build to fail if the code coverage is below 90%.
In order to do that, I created the jacocoTestCoverageVerification task to my build gradle.
jacocoTestCoverageVerification {
violationRules {
rule {
limit {
minimum = 0.9
}
}
}
}
And then I called it in my Jenkins pipeline
stage('Integration tests coverage report - Windows')
{
when { expression { env.OS == 'BAT' }}
steps {
dir('') {
bat 'gradlew.bat jacocoIntegrationReport'
bat 'gradlew.bat jacocoTestCoverageVerification'
}
}
}
But my build is not failing. I also tried to set the minimum to 1.0, but it was also successful.
I tried to add check.dependsOn jacocoTestCoverageVerification
, but the build didn't fail.
Why is it not failing?