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 开发者_Python百科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?
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.
Hudson cobertura plugin let you to rise build warnings and the native "changes" view will tell you what is the new code that do not have coverage
精彩评论