Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fail the build when there is new uncovered code?

Do any code coverage tools for Java allow you to cause the build to fail when new uncovered code gets introduced? I don't want to fail the build based on an arbitrary cutoff like 80% because in a large codebase, the actual coverage percentage rarely fluctuates. Also if coverage falls by 0.1% it's hard to tell which are the new uncovered lines.

EDIT

I'm convinced not to fail the build. The other part of the question still stands. How can I find only the uncovered code that was recently checked in?

like image 746
Craig P. Motlin Avatar asked Jul 21 '10 18:07

Craig P. Motlin


1 Answers

If you are using a continuous integration server such as Hudson, you can delegate this requirement to a new job which is dependent on the build (which runs during each commit, say).

Create a script which runs your code coverage profile, and fails based on a metric. Include a wget or cURL retrieval of the previous build's code coverage percent, parsed out, if you want to use an automatic metric.

like image 103
maxwellb Avatar answered Oct 20 '22 03:10

maxwellb