Have TeamCity build fail based on different dotCover criteria per project
My goal is to have different statement coverage levels for different projects. For example, I want very high coverage for our business logic, but willing to have lower coverage for our presentation and infrastructure layer. e.g. Fail the build if the statement coverage is lower than:
- Application - 80% coverage
- Domain - 70% coverage
- Presentation - 50% coverage
- Infrastructure - 30% coverage
With TeamCity, all the build failure conditions are very simple. e.g. Fail build on metric change and then change or constant value. With the latest release, I hoped the new dotCover runner (https://www.jetbrains.com/teamcity/whatsnew/#version-2024-03-new-dotcover-runner) might make that possible, but it doesn't seem to have helped with my problem.
Is there a way to accomplish this? It would seem like a fairly common desire.
Please sign in to leave a comment.
Yes, the fail conditions are pretty simple for this and don't cover the requirement of having different conditions for different projects that are being built with one build configuration. The recommended approach would be to build them using different build configurations and set up snapshots and, if needed, artifact dependencies to build them together.
If you need to build them in one build configuration, what I can think of as a workaround is outputting the message in the log in the cases you mentioned (Application < 80%, Domain < 70%, etc.) and then failing the build using the "Fail build on specific text in build log" condition.
Best regards,
Anton