Cobertura is another popular Java tool that calculates the percentage of code accessed by tests. It is based on jcoverage. There are many ways to use Cobertura, including standalone, through Ant script, and Maven. Let us use the Maven Cobertura plugin.
Use the following steps to analyze the code coverage with the Maven Cobertura plugin:
[INFO] <<< cobertura-maven-plugin:2.6:cobertura (default-cli) < [cobertura]test@ project-with-tests <<< [INFO] [INFO] --- cobertura-maven-plugin:2.6:cobertura (default-cli) @ project-with-tests ...