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
Chapter05under any directory, such asD:/Packt; then, add alibfolder underChapter05and copy theJUnit4andhamcrestJARs to thelibfolder. Add another folder namedChapter05under the base folderChapter05for the Java project. As per Gradle conventions, source files are kept undersrc/main/javaand test files are kept undersrc/test/java. Create the directories underChapter05\Chapter05.Tip
This
Chapter05naming 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 nameChapter05doesn't make any sense, maybe you can name it something likeSimpleGradleProjectorGradleCoverageProject. - Copy the content...