Cobertura is a free Java tool that calculates the percentage of code accessed by tests.Cobertura project can be used to identify which parts of your Java program are lacking test coverage. It is based on jcoverage.
Here are some key features of "Cobertura":
· Can be executed from ant or from the command line.
· Instruments Java bytecode after it has been compiled.
· Can generate reports in HTML or XML.
· Shows percent of lines coveraged and branches coveraged for each class, 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.
What's New in This Release:
· Much improved branch coverage. Information on whether the true as well as the false of an if statement is collected. Also, information on the branches of a switch statement (including the default) is collected. (Jiri Mares)
· Assume Java source files are saved as UTF-8 instead of the computer's default encoding.
· Write all HTML and XML reports in UTF-8 instead of the computer's default encoding (Naoki Iwami).
· Fix a bug where the Cobertura ant tasks would not work correctly in Microsoft Windows when Cobertura was installed on a different drive than the drive from which you're running ant (Srivathsan Varadarajan).
· Added a "maxmemory" attribute to the instrument, merge and report ant tasks (Matt Cordes).
· Improve support for Maven and similar environments where control over system properties is difficult such as app servers, IoC containers, IDEs, etc. Setting the datafile location is difficult in these environments. To correct this, a cobertura.properties file located in the classpath is used to properly set the net.sourceforge.cobertura.datafile property. (Joakim Erdfelt)