Cobertura is test code coverage tool. It’s free and it does job well. I tried it with projects compiled with Ant. There a few good tuts on web how to do it. And I tried it with maven. It’s even easier, you just need to put a simple entry into your pom.xml file. Something like
<reporting> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>cobertura-maven-plugin</artifactId> <version>2.4</version> </plugin> </plugins> </reporting>
And there is a worth tip to remember (because I had problem with cobertura it simply didn’t count and raport, coverage was always zero)
Uncheck option for maven “skip test ” in your favorite IDE – mine is netbeans. (For developing without testing as I did I’ve turned it off. Then I wrote junits and was firing test by hand without unchecking the box)