reporting build metrics and custom failure condition
Based on the documentation, I want to report the line code coverage percentage to teamcity (I am not using dotcover but a custom tool). So I emit this into the stdout from my build script:
##teamcity[buildStatisticValue key='CodeCoverageL' value='14.8']
Also, I defined a failure condition that should fail the build if this metrics in the last successful build is higher than it is in the current one.
If I add that failure condition I get this at the end of the build log:
Cannot calculate build metric 'percentage of line coverage' - no value
+++
What am I doing wrong?
Please sign in to leave a comment.
I'm having the same issue.
Should a different statistics value be used?
For further reference, Wim opened an issue in our tracker here: https://youtrack.jetbrains.com/issue/TW-54858
We have found that this seems to be some kind of bug, although we are investigating the problem currently. There is a workaround specified in the issue, namely:
Please try to use absolute values:
"##teamcity[buildStatisticValue key='CodeCoverageAbsLTotal' value='{0}']"
"##teamcity[buildStatisticValue key='CodeCoverageAbsLCovered' value='{0}']"
If you don't have absolute values you can publish 100 as base total:
"##teamcity[buildStatisticValue key='CodeCoverageAbsLTotal' value='{0}']" 100
"##teamcity[buildStatisticValue key='CodeCoverageAbsLCovered' value='{0}']" -f $coverage
Then use the absolute value for failure condition.