Reputation: 896
I have been using the BuildQualityChecks@8 VSBuild@1 azure pipeline task successfully up until now, when I suddenly started getting the following error:
SystemVssConnection exists true
Using IdentifierJobResolver
Validating code coverage policy...
Successfully read code coverage data from build.
Total lines: 0
Covered lines: 0
Code Coverage (%): 0
[ERROR] The code coverage value (0%, 0 lines) is lower than the minimum value (19%)!
I also noticed that my PublishBuildArtifacts@1 task (executed after BuildQualityChecks) is failing because it can't find the path to my c# code:
##[error]Publishing build artifacts failed with an error: Not found PathtoPublish: C:\a\1\s\App.Utils.cs\Utility\bin\x64\Release
This is my pipeline task:
- task: mspremier.BuildQualityChecks.QualityChecks-task.BuildQualityChecks@8
displayName: 'Check build quality'
inputs:
checkCoverage: true
coverageFailOption: fixed
coverageType: lines
coverageThreshold: 0
buildConfiguration: Test
buildPlatform: x86
I set the coverageThreshold to 0 for now in order to get a working build, but I would love to get to the root of the problem. Any help would be much appreciated.
Upvotes: 2
Views: 4505
Reputation: 11
The pipeline fails for you most likely due to the fact that you're running it with 0 covered lines and 0 total lines.
There is an option, from the available list of options viewed on the VS marketplace, to treat 0% coverage as 100%. This is turned off by default, so it might solve your problem.
This means that you should put this option into your task:
treat0of0as100: false
Upvotes: 1