1
votes

Hi guys i have a problem with my code coverage of my azure pipeline. When the CI gets trigged for the master branch the agent has a job to test the .net core. When i use this test i have to configure the route and also enable the code coverage. After the CI has been done it ended succesfully and i can download a file with the code coverage. The problem i have is i cant open this file, not with visual studio or anything else. Aynone that knows how i can fix this problem and maby i didnt configure it right?

Picture of my settings: enter image description here picture of the file enter image description here picture of the error https://i.stack.imgur.com/fxqdI.png

2

2 Answers

1
votes

Seems you are using the wrong configuration. I'm afraid --collect"Code coverage" will not work.

You could add a .NET core test task and add /p:CollectCoverage=true argument then use report generate task for adding code coverage reports.

More detail steps, please refer below tutorials:

0
votes

To generate code coverage please follow this steps

  1. Restore nuget packages enter image description here
  2. Build the app enter image description here
  3. Run unit tests (You need to add nuegte package to test projects -> coverlet.collector to use 'XPlat Code Coverage') enter image description here
  4. Install report generator enter image description here
  5. Run report generator enter image description here
  6. Publish code coverage enter image description here