I committed the changes to the pull request and yt shows
"Code coverage status failed.".
I have searched a lot, but couldn't find the cause or solution to resolve this.
Azure pipeline test service
Diff coverage check failed.0/70 (0.00 %) changed lines are covered up to update 2. Diff coverage target is 70.00 %.
Verification build is successful but the status is showing code coverage has failed.
The status check evaluates the diff coverage value for all the code files in the pull request. If you would like to view the % diff coverage value for each of the files, you can turn on details as mentioned in the configuration section.
The code coverage summary can be viewed on the Summary tab on the pipeline run summary. The results can be viewed and downloaded on the Code coverage tab.
As already explained in my previous article, the very first thing to do to add code coverage calculation is to install a NuGet package called Coverlet. This package must be installed in every test project in your Solution. So, running a simple dotnet add package coverlet. msbuild on your test projects is enough!
In Azure DevOps, go to Project Settings > Service connections. Click New service connection and select SonarQube from the service connection list. Enter your SonarQube Server URL, an Authentication Token, and a memorable Service connection name. Then, click Save.
Create an azurepipelines-coverage.yml
config file at the root of your repo with any of the following:
coverage:
status: off #default on
Turning this off will not post any coverage checks and coverage annotations will not appear in the changed files view.
coverage:
status:
diff:
target: 30% default 70%
Target threshold value for diff coverage must be met for a successful coverage status to be posted.
coverage:
status:
comments: on #default off
Indicates whether a comment containing coverage details for each code file should be posted in the pull request
Microsoft Docs; Configuring coverage settings
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With