5
votes

I have generated my xml coverage file as part of CI build on the TFS server using vNext 2015 build definition. How would one display the results in the TFS 2015 summary ? Either using the xml report or the html generated using the ReportGenerator.

4
What have you tried so far? I see that there is a way to change TFS2012 so I assume something similar exists for TFS2015 (blogs.msdn.com/b/buckh/archive/2012/06/07/…)Shaun Wilde
@Orn Kristjansson, why you choose to use OpenCover to generate code coverage result? You can just use the "Code Coverage Enabled" option to generate the code coverage result. Check my reply.Vicky - MSFT
I have xUnit tests, the mstest runner does not support noshadow copy and not code coverage either when running xUnit testsOrn Kristjansson

4 Answers

3
votes

You need to convert the results produced by OpenCover to a format which can be parsed by TFS.

One way to do this would be to use the OpenCoverToCoberturaConverter NuGet package.

Once you have that, you can use the Publish Code Coverage Results build step.

I have described the whole process on my blog.

1
votes

In “TFS 2015 - Update 2” this is possible by writing your own vsts extension (see here: https://www.visualstudio.com/en-us/docs/integrate/extensions/overview ).

I set up my own 'learning project' for building this as .vsix here: https://github.com/RobertK66/vsts-opencover.

My custom build step uses nunit3 console runner to execute tests under opencover. I managed to upload the OpenCover xml result file as 'testrun-attachment' via REST-interface and got the pieces in place to show the summary values on both the build summary tab and on its own extended “build-results-view”.

Base for this first version were a lot of examples provided by MS on github: https://github.com/Microsoft/vsts-tasks and https://github.com/Microsoft/vsts-extension-samples

To get a first feeling what places on your TFS Web Portal can be extended/customized you can download and install this extension https://aha.gallery.vsassets.io/items?itemName=ms-samples.samples-contributions-guide from the Visual Studio Marketplace.

Hope this helps to get you started.

0
votes

Currently, these customizations are not supported. You can't edit the displays in new build summary. However, you can customize Code Coverage Analysis.

You can submit it to User Voice site at: http://visualstudio.uservoice.com/forums/121579-visual-studio

-3
votes

Instead of using OpenCover extension, it is very convenience for you to generate code coverage result and include it in the build summary page this way:

Select the Visual Studio Test step, check the Code Coverage Enabled option. enter image description here

Then, the code coverage result shows on the build summary page: enter image description here