Writing Unit test cases is now mandatory for every developers in the Companies. But at the same time it is very important that we need to analyze the Unit test coverage that is done by that developer. Just writing some test cases will not make sense. Here comes the job of Cobertura.
Cobertura is an open source tool used to analyze the Coverage of Unit tests. It will give Percentage values for the Line coverage as well as Branch coverage.
Some features are listed below.
- Can be executed from ant or from the command line.
- In maven case we have Corbertura Maven plugins.
- Instruments Java bytecode after it has been compiled.
- Can generate reports in HTML or XML.
- Shows the percentage of lines and branches covered for each class, each package, and for the overall project.
- Shows the McCabe cyclomatic code complexity of each class, and the average cyclomatic code complexity for each package, and for the overall product.
- Can sort HTML results by class name, percent of lines covered, percent of branches covered, etc. And can sort in ascending or decending order.