azure-pipelines-tasks: Code Coverage Charts not shown on VSTS

Environment

  • Azure Pipelines
    • Account Name: slb1-swt
    • Project: planck
    • Build Definition Name: Delete-Me
    • Build Number: 912449
  • Agent - Private:
    • OS: Windows Server 2012

Issue Description

I’ve been able to have my .NET Solution build successfully, using the Visual Studio Build Task, and have run the Visual Studio Test Task to execute Unit Tests with code coverage enabled.

Everything seems to build and test fine with a .coverage file being generated.

However, the Code Coverage tab on the VSTS Build page only gives me the option to Download code coverage results. That downloaded results (.coverage) file does open in Visual Studio showing me the correct coverage information.

However, I was hoping that it would show charts directly in the Code Coverage Tab. But I don’t see anything. Is there something that needs to be enabled for that to work? Is this supported in .NET 4.6.1 projects?

The following is by build definition yaml

queue:
  name: ...
  demands: 
  - msbuild
  - visualstudio

steps:
- task: VSBuild@1
  displayName: 'Build Dummy.sln'
  inputs:
    solution: 'Dummy.sln'
    configuration: Release
    restoreNugetPackages: true

- task: VisualStudioTestPlatformInstaller@1
  displayName: 'Visual Studio Test Platform Installer'

- task: VSTest@2
  displayName: 'Test'
  inputs:
    testAssemblyVer2: |
     **\*.UnitTest.dll
     !**\*TestAdapter.dll
     !**\obj\**

    vsTestVersion: toolsInstaller
    overrideTestrunParameters: '-Platform x64'
    codeCoverageEnabled: true

code: .NET Framework 4.6.1 agent version: 2.141.1 visual studio test version: 2.142.11

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 2
  • Comments: 20 (9 by maintainers)

Most upvoted comments

@PBoraMSFT We found the summary page to be very lacking. image

I run code coverage for TypeScript, Python and C# code projects. The above picture is from our build - the top bar is for Python, bottom for C#.

I have 2 publish code coverage tasks with Cobertura for TS and Python.

  • Only the last publish task’s results are displayed. The first task’s summary results are overwritten.
  • There is no way to tag the coverage result with the language name. There is no way to tell the top bar is for Python. At least in VSTest it tags it with Configuration and Platform.
  • Only total line coverage is shown. No block coverage is displayed.
  • Line / block coverage for individual bars is not displayed. It is unknown what individual Python / TypeScript / C# coverage is.
  • There is no way to run .NET Core and .NET Framework assemblies in a single VSTest task with code coverage enabled. I have to run 2 separate VSTest tasks with assembly filters on.
  • If HTML reports are produced for code coverage, their files are mashed together and overwritten, making them useless to display.
  • Even without above point, HTML CSS and JavaScript is not displayed in the browser for security reasons, making HTML report viewing a useless feature. Most HTML reports rely on CSS and JavaScript for interactivity.
  • No way of specifying a generic code coverage threshold to fail the build if below. I have to resort to custom PowerShell.

If memory serves me right, this page is a regression from TFS 2015, which had much more comprehensive code coverage page.

@lucas-natraj - there are two aspects here:

  1. Charts (summary of lines covered / not covered) - this is shown in the build summary page already.
  2. Detailed reporting and Drill down - this is on the backlog and pretty high on the priority list. We are still in the design/storyboard phase for this, so I don’t have an ETA to share just yet.