Publish code coverage does not work in TFS 2015 / Visual Studio Team Services (was VS Online)

时间:2016-07-11 20:44:28

标签: code-coverage azure-devops tfsbuild tfs2015 azure-pipelines

I use "dotnet test" command in order to run the tests (running them as "Visual Studio Test" step fails for some strange reason). I generate coverage data as below:

"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Dynamic Code Coverage Tools\CodeCoverage" collect /output:code.coverage dotnet test "test\path_to_unit_tests_project\project.json"
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Dynamic Code Coverage Tools\CodeCoverage" analyze /output:code.coverage.xml code.coverage

I added "Publish Code Coverage Results" step. The build finishes successfully but I see "No build code coverage data available" in code coverage section. At the same time I see *.coverage and *.coverage.xml as additional artifacts.

Is it possible to fill that section with data coming from external code coverage tool (not VS Test step)? If not, is it possible to create a new tab showing a custom code coverage report (as below)? enter image description here

1 个答案:

答案 0 :(得分:7)

VSTS仅支持显示由"发布代码覆盖率结果"发布的代码覆盖率结果。与" JaCoCo"或者" Cobertura"格式现在。如果覆盖范围是其他格式,则覆盖结果文件将被发布但报告不会显示。

  

浏览网络中的代码覆盖率报告

     

“构建摘要”页面上已启用新的“代码覆盖率”选项卡。   以Jacoco或Cobertura格式上传代码覆盖率数据的用户将会   能够浏览代码中工具生成的HTML报告   覆盖率选项卡。

请参阅此链接以获取相关信息:2016-Jul-7 Release Notes

目前还没有任何方法可以创建显示自定义代码覆盖率报告的标签。