Cobertura is a free Java tool that calculates the percentage of code accessed by tests. It can be used to identify which parts of your Java program are lacking test coverage.
In this article, i am going to show you how to use Cobertura for maven based java application for measuring the code coverage by test cases.
Cobertura Code Coverage Report
Go to the root of the project and run the following command that will analyze the code coverage with Cobertura and generate the output report (showing the detailed analysis of coverage).
mvn cobertura:cobertura
Accessing the report
The generated code coverage analysis report can be accessed through ${project}/target/site/cobertura/index.html