Published at DZone with permission of its author, Jonathan Lermitage.
NetBeans had a (great) plugin for Java 6 unit tests
code coverage, for Ant based Java SE projects. This plugin was based on the EMMA library, which is not compatible with Java7.
Now, we have two solutions for Java 7 code coverage:
for Maven based projects, check: NetBeans documentation on
for Ant based projects, a new plugin has been developped: TikiOne JaCoCoverage. Based on
JaCoCo, it simply provides code coverage feature for Ant based projects (Java Application, Java Library, Java Project with
Existing Sources and NetBeans Modules are supported). Check:
GitHub for project's sources, news, future features under
development and documentation
NetBeans PluginPortal for download. Please note that
the plugin is validated and available in the NetBeans Plugins Manager (see
Available Plugins and look for
TikiOne JaCoCoverage is free and open source (under LGPL licensing) and currently provides:
Code highlighting: covered lines, partially covered lines and not covered lines:
Action menus to run JaCoCo with the "run" and "test" Ant tasks. That means you can compute code coverage on project run and (JUnit)
A short report displayed in the console:
For NetBeans 7.3.
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)