Tuesday, April 07, 2009

EclEmma - Java Code coverage for Eclipse

This one is indeed handy to have in your Eclipse. It is a complete code-coverage tool. Run your JUnit tests with this plug-in instead of straight JUnit, and it'll let you know where your tests don't hit.

http://www.eclemma.org/

It's also pretty easy to use. When a coverage report is desired, run the appropriate JUnit test by using the new Coverage menu or context menu: coverage as...JUnit test. JUnit will run as normal, and when done, a coverage report will be generated, and the source will be highlighted showing the test coverage.

The coverage report and highlighting are configurable. Personally, I turn off the coverage of my test source (or it's incorrectly shown as not being tested), and I turn off the highlighting of covered lines leaving only the uncovered lines highlighted. The first requires a trip to the larger coverage dialog (open the Coverage as... dialog from the coverage button or menu). The second is in the editor formatting under Windows Preferences –> General –> Editors –> Text Editors –> Annotations –> Full Coverage. (Phew!!) Easy.

Now it's easy to tell what isn't tested with no noticeable difference in test run time.

No comments: