Like Clover? Check out JCoverage
(Back in 2003 I ran a moderately popular tech blog on the Radio UserLand platform. This is an archived version of a post from that blog. You can view an index of all the archived posts.)
Monday, 30 June 2003
Like Clover, JCoverage is a code coverage analyzer for Java. "Instrument" your code with either of these tools, run your unit test suite (really, execute the code in any way), and one can generate a report on what was executed (lines, methods, branches, etc.), and more importantly, what wasn't.
Unlike Clover:
- JCoverage is GPL'ed
- JCoverage instruments the byte code (via BCEL) rather than the source, which seems substantially faster, at least under casual observation.
- JCoverage is clever enough to not instrument select lines--lines that invoke log4j for example--which means that logging calls don't pollute your coverage metrics, whether or not you run the test suite with logging on.
- JCoverage can generate a complete, parsable coverage report in XML from which you can render custom reports or derived statistics.
- JCoverage includes custom Ant tags for instrumentation, reporting and even asserting levels of coverage at a fine grained level.
- JCoverage makes it easy to merge coverage databases across several runs--for unit and functional tests, for example, or to create a single report for independently built components. (Of course, given the XML report, it may be tedious but shouldn't be difficult to do this sort of merge on "manually" either.)
With JCoverage, I think I'll need to reconsider my position that coverage analysis may be too slow to execute with every continuous integration build.