azuretestingazure-devopscode-coverageazure-dashboard

How can ı publish code covarage result on azure devops project dashboard


I apply the new man tests to the code I wrote in the pipeline and I get the code covarage as in the picture. My goal is to show this code covarage percentage in the team dashboard. I couldn't find an extension for it.

ScreenShot

1

I looked under the Azure devops extension but couldn't find any ready extensions.


Solution

  • Hi I suppose that you could refer to this extension Code Coverage Widgets

    With this widget, I could display the code coverage of my specific pipeline in the dashboards. enter image description here

    Updated on 12/21

    You need to configure this widget with a test run pipeline

    enter image description here

    =========================================================

    update 2

    I suppose that you need to add your code coverage report to the build summary with publish code coverage enter image description here

    My yaml pipeline as below. You will need additional argument to generate code coverage file as format Cobertura.

    steps:
    - task: DotNetCoreCLI@2
      displayName: 'dotnet test'
      inputs:
        command: test
        projects: ''
        arguments: '--collect:"XPlat Code Coverage" -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=cobertura'
        publishTestResults: false
    
    - task: PublishCodeCoverageResults@1
      displayName: 'Publish code coverage from **\*\coverage.cobertura.xml'
      inputs:
        codeCoverageTool: Cobertura
        summaryFileLocation: '**\*\coverage.cobertura.xml'
        reportDirectory: '$(System.DefaultWorkingDirectory)\reports'