Actually we have a requirement in grails 3x application,application build get failed if code coverage is less than 50% with jacoco library. Here 50% is threshold amount for coverage and that will be configurable it could be 50% or 70% or any other amount.
we have configured the configuration corresponding to jacoco in build.gradle file is as below-
apply plugin: 'jacoco'
jacocoTestReport{
reports {
xml.enabled false
csv.enabled false
html.destination "${buildDir}/reports/jacoco/html"
}
executionData = files('build/jacoco/test.exec')
}
test { finalizedBy jacocoTestReport }
we got proper report but not able to set build failed if coverage not match our expectation