Blog Archives

Jacoco for unit test coverage with SonarQube tutorial

This tutorial extends SonarQube with Maven Tutorial – Code Quality for Java developers to use Jacoco for tracking unit test coverage. Jacoco is the default code coverage tool that gets shipped with SonarQube. SonarQube can also be configured to use Cobertura as the code coverage tool.

This assumes that Java 8 and Maven 3 are set up. The SonarQube is setup and running on port 9000.

Step 1: The pom.xml file needs to include the following two lines under properties tag.

The revised pom.xml with sonar & jacoco will look like:

Read more ...


Maven and Cobertura Tutorial

Cobertura is a free code coverage tool, which calculates the percentage of Java code accessed by unit tests.

Step 1: The pom.xml file with the relevant reporting plugins. The properties also shown to set the coverage percentage and to skip code coverage or not.

Read more ...


500+ Enterprise & Core Java programmer & architect Q&As

Java & Big Data Tutorials

Top