如何使用jacoco构建足够的代码覆盖率

时间:2016-11-17 08:15:27

标签: java grails gradle jacoco

实际上我们在grails 3x应用程序中有一个要求,如果使用jacoco库代码覆盖率小于50%,应用程序构建会失败。这里50%是覆盖率的阈值金额,可以配置为50%或70%或任何其他金额。

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

0 个答案:

没有答案