Cobertura

Today the autobuild failed reporting us that our trial license of clover had expired. Instead of buying a $1500 license I decided to check cobertura.

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. It is based on jcoverage.

Cobertura is availlable from the codehaus sandbox, and I had to follow the instructions on the main sandbox page to get the plugin to be downloaded from the repository.

Normally this should be all. In this case, this was point where it got nasty!

The ‘mvn site’ command failed reporting a missing class (java.lang.NoClassDefFoundError: org/apache/maven/wagon/util/FileUtils). Searching for this problem yielded only 1 useful repsonse: the error is fixed in svn….

The scm url on the projectsite didn’t work so I googled arround to find the the repository:

http://svn.mojo.codehaus.org/trunk/mojo/mojo-sandbox/cobertura-maven-plugin/

After downloading the sources:

http://svn.mojo.codehaus.org/trunk/mojo/mojo-sandbox/cobertura-maven-plugin.tar.gz?view=tar

and building the plugin (and tagging it as a new version) by hand it actually worked:

coverage

Since the picture shows actual production code I had to scale it down / obfuscate it… but if you are interested, the cobertura website contains a sample report.

This entry was posted in java. Bookmark the permalink.

One Response to Cobertura

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>