1

I'm new to DevOps work and I've been tasked to setup a build for one of our .net Standard Library projects. I used the build template for this, which works great! But I want to add a code coverage into build output (there's a test project in the solution).

In the "VsTest - testAssemblies" task, I've checked the "Enable Code Coverage" option, as shown below:

enter image description here

I added a Publish code coverage task and it's asking for something called a "Summary File" - see below:

enter image description here

I'm not sure how to set this option? Has anyone done this?

I seem to get test results published in the build results without config, see below:

enter image description here

And I'd like the same for the Code Coverage tab in the build results, which is currently blank:

enter image description here

Also (may be a completely separate question), I was wondering - can I add a "Quality Gate" to say if Coverage is below 80% then fail the build?

Thanks for any advice in advance - it's a case of knowing what I want, but not sure how to achieve it!

4
  • The "Summary file" is required field, what value did you give? Commented Aug 23, 2018 at 12:06
  • I realise that :) and I haven't given a value... as I don't know what to enter :( Commented Aug 23, 2018 at 12:48
  • If you didn't enter anything in this field how did you manage to run the build? Commented Aug 26, 2018 at 14:18
  • 1
    If you want an HTML report to show up on the Code Coverage tab, this answer may help, not to mention that the tool mentioned coverlet allows for a threshold value that coverage must meet. Commented Feb 22, 2019 at 14:48

2 Answers 2

2

Hurrah!!! There is a solution for it. :)

You have to install a an Add-on to your organization in VSTS (Azure DevOps). The name of the addon is Build Quality Checks

Here is the link: https://marketplace.visualstudio.com/items?itemName=mspremier.BuildQualityChecks

It works perfectly. And this is what you want

Sign up to request clarification or add additional context in comments.

Comments

1

By default, the VsTest task will publish the Code Coverage result to Build Summary page directly. So we don't need Publish Code Coverage result task to publish the coverage result. Just make sure you have selected "Code Coverage enable" section in VsTest task.

>> Also (may be a completely separate question), I was wondering - can I add a "Quality Gate" to say if Coverage is below 80% then fail the build?

In current VSTS, we could not set "Quality Gate" to set the build failed if it doesn't match the configured % value. There has other communities also have this requirement and have submit a user voice. Please feel free to add your comments or vote it from below link: https://visualstudio.uservoice.com/forums/330519-visual-studio-team-services/suggestions/3817520-fail-build-on-insufficient-code-coverage

1 Comment

NOTE: This is available in the market place - see here: marketplace.visualstudio.com/…

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.