O'Reilly logo

Jenkins Continuous Integration Cookbook by Alan Berg

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Looking for "smelly" code through code coverage

This recipe uses Cobertura (http://cobertura.sourceforge.net/) to find the code that is not covered by unit tests.

With consistent practice, writing unit tests will become as difficult as writing debugging information to stdout. Most popular Java-specific IDE's have built-in support for running unit tests. Maven runs them as part of the test goal. If your code does not have regression tests, the code is more likely to break during refactoring. Measuring code coverage can be used to search for hotspots of non-tested code.

For more information, you can review http://onjava.com/onjava/2007/03/02/statement-branch-and-path-coverage-testing-in-java.html.

Getting ready

Install the Cobertura code coverage ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required