Emma plugin
Integrates the EMMA code coverage tool into Eclipse.
Project homepage: http://www.eclemma.org/
Automatic update URL: http://update.eclemma.org/
This is actually pretty slick. You have to do a few things to make it work, though.
- Change test and non-test to use different build folders
- Go to Java Build Path
- Check "Allow output folders for source folders"
- Change the output folder for test-related source to test-bin (anything other than the default)
- Run Coverage As... Junit test for the entire project
- This run will include both src and test
- Run Coverage As... Coverage Configuration
- On the Coverage tab, uncheck the unit tests
- Now, you should see only your source code instrumented
- Start looking for areas of poor coverage
Once you do a coverage run, you can open files from the coverage results. Covered lines will be highlighted in green, non-covered lines will be highlighted in red.
One thing I noticed is something I also saw documented online: if a block of code throws an exception partway through, EclEmma counts that entire block as untested, even if other unit tests exercise the rest of the code. This is a little annoying, especially in my socket code that throws a NoDataFound exception if the poll times out.