Simple Spring boot project implementing code coverage for the Junit Test using JaCoCo Plugin
Code coverage is a software metric used to measure how many lines of our code are executed during automated tests.
JaCoCo is an open source project, which can be used to check production code for test code coverage. It creates reports and integrates well with IDEs like the Eclipse IDE.
Integration is also available for other IDEs and continuous integration environments. So there are also Gradle, SonarQube and Jenkins plugins to make these code coverage checks outside the IDE and therefore globally available to the development team.
- Constructed basic Spring boot project using Spring Initializer
- Added JaCoCo Plugin configuration
- Implemented the required Tests
mvn clean install
mvn spring-boot:run
- Build the Project
- Move to Jacoco folder and open
target/site/jacoco/index.html
index.html
will list the coverage for the complete Project
Coverage Indicators
- Red : Not Covered
- Yellow : Partially Covered
- Green : Completely Covered