Measuring coverage using Gradle
Gradle can be configured to generate coverage reports using JaCoCo. This section will explain how to configure the Gradle JaCoCo plugin in your project.
The following are the steps to configure the Gradle plugin:
Create a base folder named
Chapter05
under any directory, such asD:/Packt
; then, add alib
folder underChapter05
and copy theJUnit4
andhamcrest
JARs to thelib
folder. Add another folder namedChapter05
under the base folderChapter05
for the Java project. As per Gradle conventions, source files are kept undersrc/main/java
and test files are kept undersrc/test/java
. Create the directories underChapter05\Chapter05
.Tip
This
Chapter05
naming strategy is used for you to easily track the project and download the code from the Packt Publishing website, but your code should express the intent of the code. The nameChapter05
doesn't make any sense, maybe you can name it something likeSimpleGradleProject
orGradleCoverageProject
.Copy the content of the...