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.
-
What have you tried so far? I see that there is a way to change TFS2012 so I assume something similar exists for TFS2015 (http://blogs.msdn.com/b/buckh/archive/2012/06/07/how-to-customize-the-build-summary-page-in-tfs-2012-without-a-plug-in.aspx) – Shaun Wilde Nov 27 '15 at 02:10
-
@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 Nov 27 '15 at 08:32
-
I have xUnit tests, the mstest runner does not support noshadow copy and not code coverage either when running xUnit tests – Orn Kristjansson Nov 30 '15 at 03:23
4 Answers
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.

- 865
- 2
- 7
- 24
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.

- 106
- 1
- 5
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

- 49,478
- 5
- 35
- 62
-
1The OP is asking about using OpenCover to do the coverage (see tag) and then displaying the results in the summary. – Shaun Wilde Nov 27 '15 at 02:09
-
The link above is associed with XAML build, the new build is displayed in the web portal. Can't find a way to custom the summary in webpage now. – PatrickLu-MSFT Nov 27 '15 at 02:48
-
Isn't that something you could [achieve](https://github.com/Microsoft/vsts-extension-samples/tree/master/build-results-enhancer) now? – Christian.K Aug 22 '17 at 09:46
-
@Christian.K Thanks for the link. It's an old question. Not available at 2015. This could be achieved since the vsts extension released. Which are not violated each other. *milosz* also provide a great solution above. Will update or delete the answer later. – PatrickLu-MSFT Aug 22 '17 at 09:57
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.
Then, the code coverage result shows on the build summary page:

- 4,970
- 1
- 14
- 22
-
I have xUnit tests, the mstest runner does not support noshadow copy and not code coverage either when running xUnit tests – Orn Kristjansson Nov 30 '15 at 17:53