Fail TeamCity build if tests do not cover lines in change set

I work on a project with a code base that is not well covered by tests and where large parts of it are slowly changing. Rather than just looking for a high level coverage metric to slowly decrease over time, it would be helpful to be more targeted by verifying that any lines of code affected by a particular change are covered by tests. Being able to fail the build if this verify step failed would be useful in keeping us honest in writing a test around assumptions of the affected old code before changing it / verify new assumptions are met.

TeamCity seems capable at some level of understanding which files and lines within those files are changed as part of a build, at least as part of diff view of the change set, and dotCover integration is capable of highlighting which rows are covered and whether tests pass / fail... so surely it is but a simple step to combine those two bits of information to give a coverage metric just for changed lines and ability to fail the build if not 100% (respecting explicit exclusions).

Of course, this may already be possible and if only I'd RTFM in depth I would be asking. Assuming it's not, any chance of this as a feature or as a TeamCity plugin?

1 comment
Comment actions Permalink

Hi David,

Currently this scenario is not possible, but it's a viable suggestion. Here's a corresponding feature request:
You are welcome to vote for it and track its status.



Please sign in to leave a comment.