Code Coverage Tool for Java


Cobertura is an open source code coverage tool. When unit/integration tests are executed it will show which lines of code were covered from the tests. This could reveal areas of code without proper coverage from tests and/or could require more testing in specific areas.

Cobertura home site

Challenges & Requirements

Cobertura will alter the java byte code and inject code at compile time. It will inject code to wrap around statements to provide an execution count. This improves performance at runtime as pointcuts do not need to be injected at all. While this would increase compilation time (possibly compiling twice) it has the tradeoff of being significantly faster at runtime.

This also makes the code doing the injection more complex as it requires a deep understanding of how compiled java code looks like.

Choose Colour