Free Code Coverage Tools

What is code coverage? When the query “define:code coverage” is run in Google, you will find the following definitions:

There are some great tools that will help you to measure the coverage of your code. Some are commercial, some are free. I used to use Clover that was great. I used point beta versions (0.9x) prior Clover went commercial with the release 1.0. My company did not see much value purchasing anything like that as unit testing and XP was not well know at that time. So I was using the last “free” Clover and I was happy as I got all I needed to keep track the code coverage of my unit tests.

With the explosion of open source projects on the web I was hoping that there would be a good free alternative to Clover after all those years. And there is. As a matter of fact there are many. Lets have a look at the free ones.

Good starting point for hunting for free stuff is at java-source.net. For code coverage tools follow this link. That is the one that I used and will cover in more details.

EMMA is an open-source toolkit for measuring and reporting Java code coverage. EMMA’s main features are:

For few sample reports generated by Emma have a look at http://emma.sourceforge.net/samples.html.

Most of my past projects used Ant for builds. Emma offers several components that expose its functionality as an ANT task and a command line tool, which is very convenient. The documentation is very well written and covers all questions that you might have.

There is also a NetBeans plug-in for Emma. Read some doco about it here.

Unfortunately, if you are looking for an Emma plug-in for Eclipse, there isn’t one. Well I could not find any easily. If you do find some, please let me know. If you need a plug-in for Eclipse that will give you a code coverage, use Coverclipse .

Happy testing and getting your code coverage reports!

Exit mobile version