How can I fail a TeamCity build if dotCover doesn't report a high enough result?

微笑、不失礼 提交于 2019-12-07 02:50:41

问题


I would like TeamCity to run my mSpec tests and report on the code covered by the tests.

I would also like TeamCity to report that a build has failed if code coverage in certain namespaces doesn't meet a threshold (e.g. MyProduct.ImportantStuff must be 100%, but MyProduct.LegacyStuff must be [23% or whatever it currently is to ensure we don't add new stuff without covering tests].

I initially looked at dotCover as it's integrated into TeamCity. I have since been looking at OpenCover as I couldn't get TC to fail the build on low coverage.

I got OpenCover working but I would still like to know (as I'm sure a lot of people would) how to get TC to fail a build if code coverage is too low.


回答1:


Are you using the latest TeamCity, ie version 7?

When setting up a build configuration you can specify this:

There are lots more options in the dropdown related to code coverage. You can also force your build to fail if you're using some other code coverage tool. For example you can echo a line to the console that will then be picked up by teamcity :

##teamcity[buildStatus status='FAILURE' text='something failed']

see official docs on this here



来源:https://stackoverflow.com/questions/10296753/how-can-i-fail-a-teamcity-build-if-dotcover-doesnt-report-a-high-enough-result

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!