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.

Step 2: Run the maven command to create the code coverage report under “${project}/target/site”.

Step 3: You can open the report from within eclipse under “${project}/target/site”. Righ mouse click on index.html and then open with “Web browser”.

maven and corbetura

maven and corbetura

You can see your code coverage in terms of unit tests. This will help you increase your unit test coverage.

Corbetura  code coverage report

Corbetura code coverage report

Step 4: Creating a maven project site with

This generates the site files under “${project}/target/site”.

mvn site report with Cobertura report link

mvn site report with Cobertura report link


800+ Java & Big Data Interview Q&As

Top