August 2017
Intermediate to advanced
332 pages
9h 16m
English
In order to run JaCoCo from Gradle, we need to add the jacoco plugin to the build.gradle file by adding the following line in the plugin section:
apply plugin: "jacoco"
Next, if we would like to make the Gradle fail in case of too low code coverage, we can add the following configuration to the build.gradle file as well:
jacocoTestCoverageVerification { violationRules { rule { limit { minimum = 0.2 } } }}
This configuration sets the minimum code coverage to 20%. We can run it with the following command:
$ ./gradlew test jacocoTestCoverageVerification
The command checks if the code coverage is at least 20%. You can play with the minimum value to see the level at which the build fails. We can also generate a test coverage ...
Read now
Unlock full access