I don’t know if you know it, but I love Jacoco. Jacoco is a very neat and easy to use coverage tool. You can easily use it with existing Java applications, it is just about giving a -javaagent to your JVM parameters. It is so easy to have coverage reports as it is to increase a PermSize.
Everybody loves Jacoco. Those who don’t love it yet simply need to give it a try to get convinced Jacoco in the only good tool for code coverage.
We did enable Jacoco for our our Tycho-based builds of JBoss Tools and JBoss Developer Studio components thanks to its Maven plugin, so we get some very nice jacoco.exec files that developer can import into their Eclipse workspace thanks to EclEmma. Then developers can see how their tests cover their code. That’s very nice.
But I think that measuring unit test coverage is not the best thing we can do with Jacoco. Since it is just about a simple argument to the Java command-line, we can think of… Enabling Jacoco by default on real execution of Java applications to track real usage and deduce which pieces of code are really used! This is pretty easy to do, and the effect on performances is low enough to be acceptable in a lot of cases, especially on desktop applications.
Knowing which pieces of your software are critical in production, and which ones are useless and should get removed is a priceless information that for sure helps you in making your software better. That’s a topic we are working on for JBoss Tools and JBoss Developer Studio, and we got some ideas on how to make it real and already have ideas of improvements to have a better control over Jacoco.
Stay tuned. soon all Java applications will use Jacoco!