Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to display a detailed code coverage report by default #19295

Open
1 of 4 tasks
rikrak opened this issue Nov 17, 2023 · 12 comments
Open
1 of 4 tasks

How to display a detailed code coverage report by default #19295

rikrak opened this issue Nov 17, 2023 · 12 comments

Comments

@rikrak
Copy link

rikrak commented Nov 17, 2023

Task name

PublishCodeCoverageResults

Task version

2

Environment type (Please select at least one enviroment where you face this issue)

  • Self-Hosted
  • Microsoft Hosted
  • VMSS Pool
  • Container

Azure DevOps Server type

dev.azure.com (formerly visualstudio.com)

Azure DevOps Server Version (if applicable)

No response

Operation system

Windows 10

Question

I have a pipeline that builds a .NET Framework project and runs MSTests, collecting code coverage using the NuGet package _coverlet.collector_ (V6.0.0).  The coverage results are published using the PublishCodeCoverageResults@2 task[1]

The coverage results are published to the pipeline successfully, which is great.
When I look at the _Code Coverage_ tab on the build summary, I see a very basic report.  There is, however, a more detailed report uploaded as a build artifact called "Code Coverage Report_<BuildId>" which is far more useful.  Is there any way of having this displayed as the default coverage report?

Note: Could be related to https://github.com/microsoft/azure-pipelines-tasks/issues/19221



[1]

    - task: DotNetCoreCLI@2
      displayName: 'Run Unit Tests'
      inputs:
        command: test
        projects: |
         **\Tests.Unit.*.csproj
        publishTestResults: false
        arguments: -c $(buildConfiguration) --logger trx --no-build --settings .\DevopsTestRun.runsettings

    - task: PublishTestResults@2
      displayName: 'Publish Test Results'
      condition: succeededOrFailed()
      inputs:
        testResultsFormat: VSTest
        testResultsFiles: '$(Build.SourcesDirectory)\TestResults\**\*.trx'
        failTaskOnMissingResultsFile: true

    - task: PublishCodeCoverageResults@2
      displayName: 'Publish code coverage'
      condition: succeededOrFailed()
      inputs:
        summaryFileLocation: |
            $(Build.SourcesDirectory)/TestResults/**/coverage.cobertura.xml
            !**/In/**/coverage.cobertura.xml
        pathToSources: '$(Build.SourcesDirectory)'
@rikrak
Copy link
Author

rikrak commented Nov 17, 2023

For reference: Basic coverage report
image

@rikrak
Copy link
Author

rikrak commented Nov 17, 2023

For reference: Detailed Report
image

@rikrak
Copy link
Author

rikrak commented Nov 17, 2023

For reference: Devops.runsettings

<?xml version="1.0" encoding="utf-8"?>
<!-- See http://msdn.microsoft.com/en-us/library/jj159530(v=vs.110).aspx for details of this file -->
<RunSettings>
  <!-- Configurations that affect the Test Framework -->
  <RunConfiguration>
    <!-- Path relative to solution directory -->
    <ResultsDirectory>.\TestResults</ResultsDirectory>
    <MaxCpuCount>4</MaxCpuCount>
  </RunConfiguration>
  
  <!-- Configurations for data collectors -->
  <DataCollectionRunSettings>
    <DataCollectors>
        <DataCollector friendlyName="XPlat Code Coverage">
            <Configuration>
                <Format>cobertura</Format>
                <SkipAutoProps>true</SkipAutoProps>
                <UseSourceLink>false</UseSourceLink>
                <ExcludeByFile>**/*Json.Version.cs</ExcludeByFile>
                <ExcludeByAttribute>ExcludeFromCodeCoverage,Obsolete,GeneratedCodeAttribute,CompilerGeneratedAttribute</ExcludeByAttribute>

            </Configuration>
        </DataCollector>
    </DataCollectors>
  </DataCollectionRunSettings>
  
  <!-- Adapter Specific sections -->
  
  <!-- MSTest adapter -->
  <MSTest>
    <MapInconclusiveToFailed>True</MapInconclusiveToFailed>
    <CaptureTraceOutput>false</CaptureTraceOutput>
    <DeleteDeploymentDirectoryAfterTestRunIsComplete>False</DeleteDeploymentDirectoryAfterTestRunIsComplete>
    <DeploymentEnabled>False</DeploymentEnabled>
  </MSTest>
   
</RunSettings>

@rikrak
Copy link
Author

rikrak commented Nov 17, 2023

For reference: PublishCodeCoverageResults task log

2023-11-17T16:08:14.9991902Z ##[debug]Evaluating condition for step: 'Publish code coverage'
2023-11-17T16:08:14.9992589Z ##[debug]Evaluating: succeededOrFailed()
2023-11-17T16:08:14.9992800Z ##[debug]Evaluating succeededOrFailed:
2023-11-17T16:08:14.9993173Z ##[debug]=> True
2023-11-17T16:08:14.9993424Z ##[debug]Result: True
2023-11-17T16:08:14.9993672Z ##[section]Starting: Publish code coverage
2023-11-17T16:08:15.0260421Z ==============================================================================
2023-11-17T16:08:15.0260551Z Task         : Publish code coverage results v2
2023-11-17T16:08:15.0260629Z Description  : Publish any of the code coverage results from a build
2023-11-17T16:08:15.0260714Z Version      : 2.229.0
2023-11-17T16:08:15.0260770Z Author       : Microsoft Corporation
2023-11-17T16:08:15.0260837Z Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/test/publish-code-coverage-results
2023-11-17T16:08:15.0260942Z ==============================================================================
2023-11-17T16:08:15.0588915Z ##[debug]Using node path: C:\agent\externals\node16\bin\node.exe
2023-11-17T16:08:15.1919299Z ##[debug]agent.TempDirectory=C:\agent\_work\_temp
2023-11-17T16:08:15.1952832Z ##[debug]loading inputs and endpoints
2023-11-17T16:08:15.1969063Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_SYSTEMVSSCONNECTION_ACCESSTOKEN
2023-11-17T16:08:15.1985538Z ##[debug]loading ENDPOINT_AUTH_SCHEME_SYSTEMVSSCONNECTION
2023-11-17T16:08:15.1987947Z ##[debug]loading ENDPOINT_AUTH_SYSTEMVSSCONNECTION
2023-11-17T16:08:15.1990902Z ##[debug]loading INPUT_FAILIFCOVERAGEEMPTY
2023-11-17T16:08:15.1993551Z ##[debug]loading INPUT_PATHTOSOURCES
2023-11-17T16:08:15.1996297Z ##[debug]loading INPUT_SUMMARYFILELOCATION
2023-11-17T16:08:15.2001913Z ##[debug]loading SECRET_SYSTEM_ACCESSTOKEN
2023-11-17T16:08:15.2008900Z ##[debug]loaded 7
2023-11-17T16:08:15.2015013Z ##[debug]Agent.ProxyUrl=undefined
2023-11-17T16:08:15.2016475Z ##[debug]Agent.CAInfo=undefined
2023-11-17T16:08:15.2016785Z ##[debug]Agent.ClientCert=undefined
2023-11-17T16:08:15.2017089Z ##[debug]Agent.SkipCertValidation=undefined
2023-11-17T16:08:15.2035062Z ##[debug]check path : C:\agent\_work\_tasks\PublishCodeCoverageResults_2a7ebc54-c13e-490e-81a5-d7561ab7cd97\2.229.0\task.json
2023-11-17T16:08:15.2038885Z ##[debug]adding resource file: C:\agent\_work\_tasks\PublishCodeCoverageResults_2a7ebc54-c13e-490e-81a5-d7561ab7cd97\2.229.0\task.json
2023-11-17T16:08:15.2040796Z ##[debug]system.culture=en-US
2023-11-17T16:08:15.2059840Z ##[debug]summaryFileLocation=C:\agent\_work\13\s/TestResults/**/coverage.cobertura.xml
!C:\agent\_work\13\s/TestResults/**/In/**/coverage.cobertura.xml
2023-11-17T16:08:15.2062765Z ##[debug]failIfCoverageEmpty=false
2023-11-17T16:08:15.2063103Z ##[debug]System.DefaultWorkingDirectory=C:\agent\_work\13\s
2023-11-17T16:08:15.2065558Z ##[debug]pathToSources=C:\agent\_work\13\s
2023-11-17T16:08:15.2070536Z ##[debug]defaultRoot: 'C:\agent\_work\13\s'
2023-11-17T16:08:15.2072483Z ##[debug]findOptions.allowBrokenSymbolicLinks: 'false'
2023-11-17T16:08:15.2072846Z ##[debug]findOptions.followSpecifiedSymbolicLink: 'false'
2023-11-17T16:08:15.2073216Z ##[debug]findOptions.followSymbolicLinks: 'false'
2023-11-17T16:08:15.2073655Z ##[debug]findOptions.skipMissingFiles: 'undefined'
2023-11-17T16:08:15.2073979Z ##[debug]matchOptions.debug: 'false'
2023-11-17T16:08:15.2074261Z ##[debug]matchOptions.nobrace: 'true'
2023-11-17T16:08:15.2074551Z ##[debug]matchOptions.noglobstar: 'false'
2023-11-17T16:08:15.2074828Z ##[debug]matchOptions.dot: 'true'
2023-11-17T16:08:15.2075415Z ##[debug]matchOptions.noext: 'false'
2023-11-17T16:08:15.2075694Z ##[debug]matchOptions.nocase: 'true'
2023-11-17T16:08:15.2075978Z ##[debug]matchOptions.nonull: 'false'
2023-11-17T16:08:15.2076256Z ##[debug]matchOptions.matchBase: 'false'
2023-11-17T16:08:15.2076535Z ##[debug]matchOptions.nocomment: 'false'
2023-11-17T16:08:15.2076815Z ##[debug]matchOptions.nonegate: 'false'
2023-11-17T16:08:15.2077109Z ##[debug]matchOptions.flipNegate: 'false'
2023-11-17T16:08:15.2080250Z ##[debug]pattern: 'C:\agent\_work\13\s/TestResults/**/coverage.cobertura.xml'
2023-11-17T16:08:15.2096417Z ##[debug]findPath: 'C:\agent\_work\13\s\TestResults'
2023-11-17T16:08:15.2096831Z ##[debug]statOnly: 'false'
2023-11-17T16:08:15.2097197Z ##[debug]findPath: 'C:\agent\_work\13\s\TestResults'
2023-11-17T16:08:15.2097571Z ##[debug]findOptions.allowBrokenSymbolicLinks: 'false'
2023-11-17T16:08:15.2097961Z ##[debug]findOptions.followSpecifiedSymbolicLink: 'false'
2023-11-17T16:08:15.2098324Z ##[debug]findOptions.followSymbolicLinks: 'false'
2023-11-17T16:08:15.2098625Z ##[debug]findOptions.skipMissingFiles: 'undefined'
2023-11-17T16:08:15.2102616Z ##[debug]  C:\agent\_work\13\s\TestResults (directory)
2023-11-17T16:08:15.2106248Z ##[debug]  C:\agent\_work\13\s\TestResults\b1b9f6e9-497e-4be5-9b8e-8681a368e6b8 (directory)
2023-11-17T16:08:15.2108418Z ##[debug]  C:\agent\_work\13\s\TestResults\b1b9f6e9-497e-4be5-9b8e-8681a368e6b8\coverage.cobertura.xml (file)
2023-11-17T16:08:15.2111604Z ##[debug]  C:\agent\_work\13\s\TestResults\c6f139f8-9c08-4761-bb95-cfe7068528bf (directory)
2023-11-17T16:08:15.2112620Z ##[debug]  C:\agent\_work\13\s\TestResults\c6f139f8-9c08-4761-bb95-cfe7068528bf\coverage.cobertura.xml (file)
2023-11-17T16:08:15.2113955Z ##[debug]  C:\agent\_work\13\s\TestResults\Deploy_BUILDSERVER$ 20231117T160803 (directory)
2023-11-17T16:08:15.2116625Z ##[debug]  C:\agent\_work\13\s\TestResults\Deploy_BUILDSERVER$ 20231117T160803\In (directory)
2023-11-17T16:08:15.2118772Z ##[debug]  C:\agent\_work\13\s\TestResults\Deploy_BUILDSERVER$ 20231117T160803\In\BUILDSERVER (directory)
2023-11-17T16:08:15.2121566Z ##[debug]  C:\agent\_work\13\s\TestResults\Deploy_BUILDSERVER$ 20231117T160803\Out (directory)
2023-11-17T16:08:15.2123540Z ##[debug]  C:\agent\_work\13\s\TestResults\Deploy_BUILDSERVER$ 20231117T160807 (directory)
2023-11-17T16:08:15.2127509Z ##[debug]  C:\agent\_work\13\s\TestResults\Deploy_BUILDSERVER$ 20231117T160807\In (directory)
2023-11-17T16:08:15.2129544Z ##[debug]  C:\agent\_work\13\s\TestResults\Deploy_BUILDSERVER$ 20231117T160807\In\BUILDSERVER (directory)
2023-11-17T16:08:15.2131338Z ##[debug]  C:\agent\_work\13\s\TestResults\Deploy_BUILDSERVER$ 20231117T160807\Out (directory)
2023-11-17T16:08:15.2133084Z ##[debug]  C:\agent\_work\13\s\TestResults\BUILDSERVER$_BUILDSERVER_2023-11-17_16_08_04 (directory)
2023-11-17T16:08:15.2134953Z ##[debug]  C:\agent\_work\13\s\TestResults\BUILDSERVER$_BUILDSERVER_2023-11-17_16_08_04\In (directory)
2023-11-17T16:08:15.2136871Z ##[debug]  C:\agent\_work\13\s\TestResults\BUILDSERVER$_BUILDSERVER_2023-11-17_16_08_04\In\BUILDSERVER (directory)
2023-11-17T16:08:15.2138794Z ##[debug]  C:\agent\_work\13\s\TestResults\BUILDSERVER$_BUILDSERVER_2023-11-17_16_08_04\In\BUILDSERVER\coverage.cobertura.xml (file)
2023-11-17T16:08:15.2139254Z ##[debug]  C:\agent\_work\13\s\TestResults\BUILDSERVER$_BUILDSERVER_2023-11-17_16_08_04.trx (file)
2023-11-17T16:08:15.2141905Z ##[debug]  C:\agent\_work\13\s\TestResults\BUILDSERVER$_BUILDSERVER_2023-11-17_16_08_07 (directory)
2023-11-17T16:08:15.2143870Z ##[debug]  C:\agent\_work\13\s\TestResults\BUILDSERVER$_BUILDSERVER_2023-11-17_16_08_07\In (directory)
2023-11-17T16:08:15.2145676Z ##[debug]  C:\agent\_work\13\s\TestResults\BUILDSERVER$_BUILDSERVER_2023-11-17_16_08_07\In\BUILDSERVER (directory)
2023-11-17T16:08:15.2147521Z ##[debug]  C:\agent\_work\13\s\TestResults\BUILDSERVER$_BUILDSERVER_2023-11-17_16_08_07\In\BUILDSERVER\coverage.cobertura.xml (file)
2023-11-17T16:08:15.2148050Z ##[debug]  C:\agent\_work\13\s\TestResults\BUILDSERVER$_BUILDSERVER_2023-11-17_16_08_07.trx (file)
2023-11-17T16:08:15.2148775Z ##[debug]23 results
2023-11-17T16:08:15.2149041Z ##[debug]found 23 paths
2023-11-17T16:08:15.2149310Z ##[debug]applying include pattern
2023-11-17T16:08:15.2159818Z ##[debug]4 matches
2023-11-17T16:08:15.2160406Z ##[debug]4 final results
2023-11-17T16:08:15.2180983Z Found 4 result(s) matching pattern: C:\agent\_work\13\s/TestResults/**/coverage.cobertura.xml
2023-11-17T16:08:15.2184368Z C:\agent\_work\13\s\TestResults\BUILDSERVER$_BUILDSERVER_2023-11-17_16_08_04\In\BUILDSERVER\coverage.cobertura.xml
2023-11-17T16:08:15.2185649Z C:\agent\_work\13\s\TestResults\BUILDSERVER$_BUILDSERVER_2023-11-17_16_08_07\In\BUILDSERVER\coverage.cobertura.xml
2023-11-17T16:08:15.2187243Z C:\agent\_work\13\s\TestResults\b1b9f6e9-497e-4be5-9b8e-8681a368e6b8\coverage.cobertura.xml
2023-11-17T16:08:15.2188183Z C:\agent\_work\13\s\TestResults\c6f139f8-9c08-4761-bb95-cfe7068528bf\coverage.cobertura.xml
2023-11-17T16:08:15.2188699Z ##[debug]defaultRoot: 'C:\agent\_work\13\s'
2023-11-17T16:08:15.2189084Z ##[debug]findOptions.allowBrokenSymbolicLinks: 'false'
2023-11-17T16:08:15.2189436Z ##[debug]findOptions.followSpecifiedSymbolicLink: 'false'
2023-11-17T16:08:15.2189737Z ##[debug]findOptions.followSymbolicLinks: 'false'
2023-11-17T16:08:15.2190034Z ##[debug]findOptions.skipMissingFiles: 'undefined'
2023-11-17T16:08:15.2190322Z ##[debug]matchOptions.debug: 'false'
2023-11-17T16:08:15.2190609Z ##[debug]matchOptions.nobrace: 'true'
2023-11-17T16:08:15.2190895Z ##[debug]matchOptions.noglobstar: 'false'
2023-11-17T16:08:15.2191171Z ##[debug]matchOptions.dot: 'true'
2023-11-17T16:08:15.2191444Z ##[debug]matchOptions.noext: 'false'
2023-11-17T16:08:15.2191721Z ##[debug]matchOptions.nocase: 'true'
2023-11-17T16:08:15.2192005Z ##[debug]matchOptions.nonull: 'false'
2023-11-17T16:08:15.2192284Z ##[debug]matchOptions.matchBase: 'false'
2023-11-17T16:08:15.2192564Z ##[debug]matchOptions.nocomment: 'false'
2023-11-17T16:08:15.2192842Z ##[debug]matchOptions.nonegate: 'false'
2023-11-17T16:08:15.2193309Z ##[debug]matchOptions.flipNegate: 'false'
2023-11-17T16:08:15.2193673Z ##[debug]pattern: '!C:\agent\_work\13\s/TestResults/**/In/**/coverage.cobertura.xml'
2023-11-17T16:08:15.2194026Z ##[debug]trimmed leading '!'. pattern: 'C:\agent\_work\13\s/TestResults/**/In/**/coverage.cobertura.xml'
2023-11-17T16:08:15.2194395Z ##[debug]after ensurePatternRooted, pattern: 'C:\agent\_work\13\s/TestResults/**/In/**/coverage.cobertura.xml'
2023-11-17T16:08:15.2194728Z ##[debug]applying exclude pattern
2023-11-17T16:08:15.2194985Z ##[debug]0 matches
2023-11-17T16:08:15.2195239Z ##[debug]0 final results
2023-11-17T16:08:15.2195465Z Found 0 result(s) matching pattern: !C:\agent\_work\13\s/TestResults/**/In/**/coverage.cobertura.xml
2023-11-17T16:08:15.2196842Z ##[debug]Agent.Version=3.220.0
2023-11-17T16:08:15.2197172Z ##[debug]Agent.TempDirectory=C:\agent\_work\_temp
2023-11-17T16:08:15.2205681Z ##[debug]which 'dotnet'
2023-11-17T16:08:15.2238264Z ##[debug]found: 'C:\agent\_work\_tool\dotnet\dotnet.exe'
2023-11-17T16:08:15.2238939Z ##[debug]which 'C:\agent\_work\_tasks\PublishCodeCoverageResults_2a7ebc54-c13e-490e-81a5-d7561ab7cd97\2.229.0\node_modules\coveragepublisher\CoveragePublisher\CoveragePublisher.Console.exe'
2023-11-17T16:08:15.2241167Z ##[debug]found: 'C:\agent\_work\_tasks\PublishCodeCoverageResults_2a7ebc54-c13e-490e-81a5-d7561ab7cd97\2.229.0\node_modules\coveragepublisher\CoveragePublisher\CoveragePublisher.Console.exe'
2023-11-17T16:08:15.2242363Z ##[debug]C:\agent\_work\_tasks\PublishCodeCoverageResults_2a7ebc54-c13e-490e-81a5-d7561ab7cd97\2.229.0\node_modules\coveragepublisher\CoveragePublisher\CoveragePublisher.Console.exe arg: C:\agent\_work\13\s\TestResults\BUILDSERVER$_BUILDSERVER_2023-11-17_16_08_04\In\BUILDSERVER\coverage.cobertura.xml
2023-11-17T16:08:15.2243051Z ##[debug]C:\agent\_work\_tasks\PublishCodeCoverageResults_2a7ebc54-c13e-490e-81a5-d7561ab7cd97\2.229.0\node_modules\coveragepublisher\CoveragePublisher\CoveragePublisher.Console.exe arg: C:\agent\_work\13\s\TestResults\BUILDSERVER$_BUILDSERVER_2023-11-17_16_08_07\In\BUILDSERVER\coverage.cobertura.xml
2023-11-17T16:08:15.2243932Z ##[debug]C:\agent\_work\_tasks\PublishCodeCoverageResults_2a7ebc54-c13e-490e-81a5-d7561ab7cd97\2.229.0\node_modules\coveragepublisher\CoveragePublisher\CoveragePublisher.Console.exe arg: C:\agent\_work\13\s\TestResults\b1b9f6e9-497e-4be5-9b8e-8681a368e6b8\coverage.cobertura.xml
2023-11-17T16:08:15.2244543Z ##[debug]C:\agent\_work\_tasks\PublishCodeCoverageResults_2a7ebc54-c13e-490e-81a5-d7561ab7cd97\2.229.0\node_modules\coveragepublisher\CoveragePublisher\CoveragePublisher.Console.exe arg: C:\agent\_work\13\s\TestResults\c6f139f8-9c08-4761-bb95-cfe7068528bf\coverage.cobertura.xml
2023-11-17T16:08:15.2245223Z ##[debug]C:\agent\_work\_tasks\PublishCodeCoverageResults_2a7ebc54-c13e-490e-81a5-d7561ab7cd97\2.229.0\node_modules\coveragepublisher\CoveragePublisher\CoveragePublisher.Console.exe arg: --reportDirectory
2023-11-17T16:08:15.2245769Z ##[debug]C:\agent\_work\_tasks\PublishCodeCoverageResults_2a7ebc54-c13e-490e-81a5-d7561ab7cd97\2.229.0\node_modules\coveragepublisher\CoveragePublisher\CoveragePublisher.Console.exe arg: C:\agent\_work\_temp\6e7c069e-180d-4400-9a88-bec1a986e9aa
2023-11-17T16:08:15.2246323Z ##[debug]C:\agent\_work\_tasks\PublishCodeCoverageResults_2a7ebc54-c13e-490e-81a5-d7561ab7cd97\2.229.0\node_modules\coveragepublisher\CoveragePublisher\CoveragePublisher.Console.exe arg: --sourceDirectory
2023-11-17T16:08:15.2246838Z ##[debug]C:\agent\_work\_tasks\PublishCodeCoverageResults_2a7ebc54-c13e-490e-81a5-d7561ab7cd97\2.229.0\node_modules\coveragepublisher\CoveragePublisher\CoveragePublisher.Console.exe arg: C:\agent\_work\13\s
2023-11-17T16:08:15.2249753Z ##[debug]SystemVssConnection auth param AccessToken = ***
2023-11-17T16:08:15.2250118Z ##[debug]System.TeamFoundationCollectionUri=https://xxx.visualstudio.com/
2023-11-17T16:08:15.2250428Z ##[debug]Build.BuildId=21524
2023-11-17T16:08:15.2250702Z ##[debug]Build.ContainerId=4793903
2023-11-17T16:08:15.2250987Z ##[debug]Agent.TempPath=undefined
2023-11-17T16:08:15.2251285Z ##[debug]System.TeamProjectId=08xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxe34b
2023-11-17T16:08:15.2251605Z ##[debug]PIPELINES_COVERAGEPUBLISHER_DEBUG=undefined
2023-11-17T16:08:15.2254650Z ##[debug]exec tool: C:\agent\_work\_tasks\PublishCodeCoverageResults_2a7ebc54-c13e-490e-81a5-d7561ab7cd97\2.229.0\node_modules\coveragepublisher\CoveragePublisher\CoveragePublisher.Console.exe
2023-11-17T16:08:15.2255055Z ##[debug]arguments:
2023-11-17T16:08:15.2255386Z ##[debug]   C:\agent\_work\13\s\TestResults\BUILDSERVER$_BUILDSERVER_2023-11-17_16_08_04\In\BUILDSERVER\coverage.cobertura.xml
2023-11-17T16:08:15.2255783Z ##[debug]   C:\agent\_work\13\s\TestResults\BUILDSERVER$_BUILDSERVER_2023-11-17_16_08_07\In\BUILDSERVER\coverage.cobertura.xml
2023-11-17T16:08:15.2256158Z ##[debug]   C:\agent\_work\13\s\TestResults\b1b9f6e9-497e-4be5-9b8e-8681a368e6b8\coverage.cobertura.xml
2023-11-17T16:08:15.2256521Z ##[debug]   C:\agent\_work\13\s\TestResults\c6f139f8-9c08-4761-bb95-cfe7068528bf\coverage.cobertura.xml
2023-11-17T16:08:15.2256841Z ##[debug]   --reportDirectory
2023-11-17T16:08:15.2257132Z ##[debug]   C:\agent\_work\_temp\6e7c069e-180d-4400-9a88-bec1a986e9aa
2023-11-17T16:08:15.2257419Z ##[debug]   --sourceDirectory
2023-11-17T16:08:15.2257679Z ##[debug]   C:\agent\_work\13\s
2023-11-17T16:08:15.2260803Z [command]"C:\agent\_work\_tasks\PublishCodeCoverageResults_2a7ebc54-c13e-490e-81a5-d7561ab7cd97\2.229.0\node_modules\coveragepublisher\CoveragePublisher\CoveragePublisher.Console.exe" C:\agent\_work\13\s\TestResults\BUILDSERVER$_BUILDSERVER_2023-11-17_16_08_04\In\BUILDSERVER\coverage.cobertura.xml C:\agent\_work\13\s\TestResults\BUILDSERVER$_BUILDSERVER_2023-11-17_16_08_07\In\BUILDSERVER\coverage.cobertura.xml C:\agent\_work\13\s\TestResults\b1b9f6e9-497e-4be5-9b8e-8681a368e6b8\coverage.cobertura.xml C:\agent\_work\13\s\TestResults\c6f139f8-9c08-4761-bb95-cfe7068528bf\coverage.cobertura.xml --reportDirectory C:\agent\_work\_temp\6e7c069e-180d-4400-9a88-bec1a986e9aa --sourceDirectory C:\agent\_work\13\s
2023-11-17T16:08:16.6085679Z ##[debug]PERF : Parser.Parsing : took 0.2691 ms.
2023-11-17T16:08:16.7159606Z ##[debug]Publishing file json coverage is supported.
2023-11-17T16:08:16.7174507Z ##[debug]ReportGeneratorTool.ParseCoverageFiles: Parsing coverage files.
2023-11-17T16:08:16.7363931Z 2023-11-17T16:08:16: Loading report 'C:\agent\_work\13\s\TestResults\BUILDSERVER$_BUILDSERVER_2023-11-17_16_08_04\In\BUILDSERVER\coverage.cobertura.xml' 1/4 in memory
2023-11-17T16:08:16.7445209Z 2023-11-17T16:08:16: Preprocessing report
2023-11-17T16:08:16.7464262Z 2023-11-17T16:08:16: Initiating parser for Cobertura
2023-11-17T16:08:16.7543852Z 2023-11-17T16:08:16: Current Assembly: Aes
2023-11-17T16:08:16.7693743Z 2023-11-17T16:08:16: Finished parsing 'C:\agent\_work\13\s\TestResults\BUILDSERVER$_BUILDSERVER_2023-11-17_16_08_04\In\BUILDSERVER\coverage.cobertura.xml' 1/4
2023-11-17T16:08:16.7694761Z 2023-11-17T16:08:16: Loading report 'C:\agent\_work\13\s\TestResults\BUILDSERVER$_BUILDSERVER_2023-11-17_16_08_07\In\BUILDSERVER\coverage.cobertura.xml' 2/4 in memory
2023-11-17T16:08:16.7695481Z 2023-11-17T16:08:16: Starting merging result 1
2023-11-17T16:08:16.7704531Z 2023-11-17T16:08:16: Finished merging result 1
2023-11-17T16:08:16.8070372Z 2023-11-17T16:08:16: Preprocessing report
2023-11-17T16:08:16.8073839Z 2023-11-17T16:08:16: Initiating parser for Cobertura
2023-11-17T16:08:16.8076010Z 2023-11-17T16:08:16: Current Assembly: Common.Application.DataType
2023-11-17T16:08:16.8157606Z 2023-11-17T16:08:16: Finished parsing 'C:\agent\_work\13\s\TestResults\BUILDSERVER$_BUILDSERVER_2023-11-17_16_08_07\In\BUILDSERVER\coverage.cobertura.xml' 2/4
2023-11-17T16:08:16.8158232Z 2023-11-17T16:08:16: Starting merging result 2
2023-11-17T16:08:16.8158646Z 2023-11-17T16:08:16: Loading report 'C:\agent\_work\13\s\TestResults\b1b9f6e9-497e-4be5-9b8e-8681a368e6b8\coverage.cobertura.xml' 3/4 in memory
2023-11-17T16:08:16.8158996Z 2023-11-17T16:08:16: Finished merging result 2
2023-11-17T16:08:16.8531769Z 2023-11-17T16:08:16: Preprocessing report
2023-11-17T16:08:16.8534560Z 2023-11-17T16:08:16: Initiating parser for Cobertura
2023-11-17T16:08:16.8536843Z 2023-11-17T16:08:16: Current Assembly: Common.Application.DataType
2023-11-17T16:08:16.8574128Z 2023-11-17T16:08:16: Finished parsing 'C:\agent\_work\13\s\TestResults\b1b9f6e9-497e-4be5-9b8e-8681a368e6b8\coverage.cobertura.xml' 3/4
2023-11-17T16:08:16.8574615Z 2023-11-17T16:08:16: Starting merging result 3
2023-11-17T16:08:16.8575060Z 2023-11-17T16:08:16: Loading report 'C:\agent\_work\13\s\TestResults\c6f139f8-9c08-4761-bb95-cfe7068528bf\coverage.cobertura.xml' 4/4 in memory
2023-11-17T16:08:16.8596449Z 2023-11-17T16:08:16: Preprocessing report
2023-11-17T16:08:16.8597037Z 2023-11-17T16:08:16: Initiating parser for Cobertura
2023-11-17T16:08:16.8597323Z 2023-11-17T16:08:16: Current Assembly: Aes
2023-11-17T16:08:16.8597778Z 2023-11-17T16:08:16: Finished parsing 'C:\agent\_work\13\s\TestResults\c6f139f8-9c08-4761-bb95-cfe7068528bf\coverage.cobertura.xml' 4/4
2023-11-17T16:08:16.8598126Z 2023-11-17T16:08:16: Parsing of 4 files completed
2023-11-17T16:08:16.8635669Z 2023-11-17T16:08:16: Finished merging result 3
2023-11-17T16:08:16.8636009Z 2023-11-17T16:08:16: Starting merging result 4
2023-11-17T16:08:16.8636272Z 2023-11-17T16:08:16: Finished merging result 4
2023-11-17T16:08:16.8645796Z ##[debug]ReportGeneratorTool.CreateHTMLReportFromParserResult: Creating HTML report.
2023-11-17T16:08:16.8910048Z 2023-11-17T16:08:16: Initializing report builders for report types: HtmlInline_AzurePipelines
2023-11-17T16:08:16.8962559Z 2023-11-17T16:08:16: Analyzing 58 classes
2023-11-17T16:08:16.8963846Z 2023-11-17T16:08:16: Creating report 1/58 (Assembly: Aes, Class: Aes.AesDecoder)
2023-11-17T16:08:16.9083056Z 2023-11-17T16:08:16: Writing report file 'Aes_AesDecoder.html'
2023-11-17T16:08:16.9445673Z 2023-11-17T16:08:16: Creating report 2/58 (Assembly: Aes, Class: Aes.AesEncoder)
2023-11-17T16:08:16.9454766Z 2023-11-17T16:08:16: Writing report file 'Aes_AesEncoder.html'
... abridged ...
2023-11-17T16:08:18.2331805Z 2023-11-17T16:08:18: Creating report 57/58 (Assembly: Common.Application.DataType, Class: Common.Application.DataType.Validation.IsXmlAttribute)
2023-11-17T16:08:18.2335136Z 2023-11-17T16:08:18: Writing report file 'Common.Application.DataType_IsXmlAttribute.html'
2023-11-17T16:08:18.2522339Z 2023-11-17T16:08:18: Creating report 58/58 (Assembly: Common.Application.DataType, Class: Common.Application.DataType.Validation.StringExtensions)
2023-11-17T16:08:18.2525339Z 2023-11-17T16:08:18: Writing report file 'Common.Application.DataType_StringExtensions.html'
2023-11-17T16:08:18.2720210Z 2023-11-17T16:08:18: Creating summary
2023-11-17T16:08:18.2759466Z 2023-11-17T16:08:18: Writing report file 'C:\agent\_work\_temp\6e7c069e-180d-4400-9a88-bec1a986e9aa\index.html'
2023-11-17T16:08:18.3438907Z ##[debug]Parser.GenerateHTMLReport: Creating summary file directory: C:\agent\_work\_temp\6e7c069e-180d-4400-9a88-bec1a986e9aa\Summary_1ffa78d2
2023-11-17T16:08:18.3444715Z ##[debug]Parser.GenerateHTMLReport: Copying summary file C:\agent\_work\13\s\TestResults\BUILDSERVER$_BUILDSERVER_2023-11-17_16_08_04\In\BUILDSERVER\coverage.cobertura.xml
2023-11-17T16:08:18.3455257Z ##[debug]Parser.GenerateHTMLReport: Copying summary file C:\agent\_work\13\s\TestResults\BUILDSERVER$_BUILDSERVER_2023-11-17_16_08_07\In\BUILDSERVER\coverage.cobertura.xml
2023-11-17T16:08:18.3465955Z ##[debug]Parser.GenerateHTMLReport: Copying summary file C:\agent\_work\13\s\TestResults\b1b9f6e9-497e-4be5-9b8e-8681a368e6b8\coverage.cobertura.xml
2023-11-17T16:08:18.3477233Z ##[debug]Parser.GenerateHTMLReport: Copying summary file C:\agent\_work\13\s\TestResults\c6f139f8-9c08-4761-bb95-cfe7068528bf\coverage.cobertura.xml
2023-11-17T16:08:18.3491061Z ##[debug]PERF : Parser.ReportGeneration : took 1484.7219 ms.
2023-11-17T16:08:18.3501141Z ##[debug]ReportGeneratorTool.GetFileCoverageInfos: Generating file coverage info from coverage files.
2023-11-17T16:08:18.3547213Z Publishing file coverage data.
2023-11-17T16:08:18.4033766Z ##[debug]PublisherTraceSource Verbose: 0 : 
2023-11-17T16:08:18.4034297Z ##[debug]Entering UploadTestBuildLogAsync
2023-11-17T16:08:18.6115489Z ##[debug]PublisherTraceSource Verbose: 0 : 
2023-11-17T16:08:18.6116048Z ##[debug]Blob name: Intermediate/06e26a2e-b937-4b7d-8cd1-fb8710d9dea32152448f45629-a407-4e96-8eb0-2f73e3e1bb4d.cjson .
2023-11-17T16:08:19.4383323Z ##[debug]PublisherTraceSource Verbose: 0 : 
2023-11-17T16:08:19.4383841Z ##[debug]File uploaded successsfully on LogStore 06e26a2e-b937-4b7d-8cd1-fb8710d9dea321524.cjson
2023-11-17T16:08:19.4401912Z ##[debug]PERF : AzurePipelinesPublisher.UploadFileCoverage : took 1038.407 ms.
2023-11-17T16:08:19.4408454Z ##[debug]PERF : CoverageProcesser.PublishFileCoverage : took 1088.7041 ms.
2023-11-17T16:08:19.4423708Z Publishing code coverage HTML report.
2023-11-17T16:08:19.4487946Z Uploading 61 files.
2023-11-17T16:08:19.5886287Z ##[debug]PublisherTraceSource Information: 0 : 
2023-11-17T16:08:19.5887344Z ##[debug]Failed to publish Telemetry Exception: Object reference not set to an instance of an object.
2023-11-17T16:08:19.6401230Z ##[debug]File: 'C:\agent\_work\_temp\6e7c069e-180d-4400-9a88-bec1a986e9aa\Aes_AesDecoder.html' took 187 milliseconds to finish upload.
2023-11-17T16:08:19.6402012Z ##[debug]Detail upload trace for file: Code Coverage Report_21524/Aes_AesDecoder.html
2023-11-17T16:08:19.6402416Z ##[debug]File 'Code Coverage Report_21524/Aes_AesDecoder.html' will be uploaded in one chunk.
2023-11-17T16:08:19.6402792Z ##[debug]Attempt '1' for uploading chunk '1' of file 'Code Coverage Report_21524/Aes_AesDecoder.html'.
2023-11-17T16:08:19.6403176Z ##[debug]Generate new HttpRequest for uploading file 'Code Coverage Report_21524/Aes_AesDecoder.html', chunk '1' of '1'.
2023-11-17T16:08:19.6403552Z ##[debug]Start uploading file 'Code Coverage Report_21524/Aes_AesDecoder.html' to server, chunk '1'.
2023-11-17T16:08:19.6404732Z ##[debug]Finished upload chunk '1' of file 'Code Coverage Report_21524/Aes_AesDecoder.html', elapsed 171 (ms), response code 'Created'.
... abridged ...
2023-11-17T16:08:22.8657591Z ##[debug]File: 'C:\agent\_work\_temp\6e7c069e-180d-4400-9a88-bec1a986e9aa\Common.Application.DataType_IsXmlAttribute.html' took 168 milliseconds to finish upload.
2023-11-17T16:08:22.8658128Z ##[debug]Detail upload trace for file: Code Coverage Report_21524/Common.Application.DataType_IsXmlAttribute.html
2023-11-17T16:08:22.8658526Z ##[debug]File 'Code Coverage Report_21524/Common.Application.DataType_IsXmlAttribute.html' will be uploaded in one chunk.
2023-11-17T16:08:22.8659173Z ##[debug]Attempt '1' for uploading chunk '1' of file 'Code Coverage Report_21524/Common.Application.DataType_IsXmlAttribute.html'.
2023-11-17T16:08:22.8659587Z ##[debug]Generate new HttpRequest for uploading file 'Code Coverage Report_21524/Common.Application.DataType_IsXmlAttribute.html', chunk '1' of '1'.
2023-11-17T16:08:22.8660002Z ##[debug]Start uploading file 'Code Coverage Report_21524/Common.Application.DataType_IsXmlAttribute.html' to server, chunk '1'.
2023-11-17T16:08:22.8660560Z ##[debug]Finished upload chunk '1' of file 'Code Coverage Report_21524/Common.Application.DataType_IsXmlAttribute.html', elapsed 164 (ms), response code 'Created'.
... abridged ...
2023-11-17T16:08:24.7172624Z ##[debug]File: 'C:\agent\_work\_temp\6e7c069e-180d-4400-9a88-bec1a986e9aa\Common.Application.DataType_StringExtensions.html' took 158 milliseconds to finish upload.
2023-11-17T16:08:24.7173160Z ##[debug]Detail upload trace for file: Code Coverage Report_21524/Common.Application.DataType_StringExtensions.html
2023-11-17T16:08:24.7173565Z ##[debug]File 'Code Coverage Report_21524/Common.Application.DataType_StringExtensions.html' will be uploaded in one chunk.
2023-11-17T16:08:24.7174233Z ##[debug]Attempt '1' for uploading chunk '1' of file 'Code Coverage Report_21524/Common.Application.DataType_StringExtensions.html'.
2023-11-17T16:08:24.7174650Z ##[debug]Generate new HttpRequest for uploading file 'Code Coverage Report_21524/Common.Application.DataType_StringExtensions.html', chunk '1' of '1'.
2023-11-17T16:08:24.7175073Z ##[debug]Start uploading file 'Code Coverage Report_21524/Common.Application.DataType_StringExtensions.html' to server, chunk '1'.
2023-11-17T16:08:24.7175504Z ##[debug]Finished upload chunk '1' of file 'Code Coverage Report_21524/Common.Application.DataType_StringExtensions.html', elapsed 154 (ms), response code 'Created'.
... abridged ...
2023-11-17T16:08:25.2682030Z ##[debug]File: 'C:\agent\_work\_temp\6e7c069e-180d-4400-9a88-bec1a986e9aa\index.htm' took 227 milliseconds to finish upload.
2023-11-17T16:08:25.2682542Z ##[debug]Detail upload trace for file: Code Coverage Report_21524/index.htm
2023-11-17T16:08:25.2682891Z ##[debug]File 'Code Coverage Report_21524/index.htm' will be uploaded in one chunk.
2023-11-17T16:08:25.2683246Z ##[debug]Attempt '1' for uploading chunk '1' of file 'Code Coverage Report_21524/index.htm'.
2023-11-17T16:08:25.2683629Z ##[debug]Generate new HttpRequest for uploading file 'Code Coverage Report_21524/index.htm', chunk '1' of '1'.
2023-11-17T16:08:25.2684001Z ##[debug]Start uploading file 'Code Coverage Report_21524/index.htm' to server, chunk '1'.
2023-11-17T16:08:25.2684367Z ##[debug]Finished upload chunk '1' of file 'Code Coverage Report_21524/index.htm', elapsed 214 (ms), response code 'Created'.
2023-11-17T16:08:25.3441520Z ##[debug]File: 'C:\agent\_work\_temp\6e7c069e-180d-4400-9a88-bec1a986e9aa\index.html' took 190 milliseconds to finish upload.
2023-11-17T16:08:25.3441980Z ##[debug]Detail upload trace for file: Code Coverage Report_21524/index.html
2023-11-17T16:08:25.3442366Z ##[debug]File 'Code Coverage Report_21524/index.html' will be uploaded in one chunk.
2023-11-17T16:08:25.3442711Z ##[debug]Attempt '1' for uploading chunk '1' of file 'Code Coverage Report_21524/index.html'.
2023-11-17T16:08:25.3443079Z ##[debug]Generate new HttpRequest for uploading file 'Code Coverage Report_21524/index.html', chunk '1' of '1'.
2023-11-17T16:08:25.3443448Z ##[debug]Start uploading file 'Code Coverage Report_21524/index.html' to server, chunk '1'.
2023-11-17T16:08:25.3443816Z ##[debug]Finished upload chunk '1' of file 'Code Coverage Report_21524/index.html', elapsed 177 (ms), response code 'Created'.
2023-11-17T16:08:25.4563846Z ##[debug]File: 'C:\agent\_work\_temp\6e7c069e-180d-4400-9a88-bec1a986e9aa\Summary_1ffa78d2\coverage.cobertura.xml' took 185 milliseconds to finish upload.
2023-11-17T16:08:25.4564648Z ##[debug]Detail upload trace for file: Code Coverage Report_21524/Summary_1ffa78d2/coverage.cobertura.xml
2023-11-17T16:08:25.4565075Z ##[debug]File 'Code Coverage Report_21524/Summary_1ffa78d2/coverage.cobertura.xml' will be uploaded in one chunk.
2023-11-17T16:08:25.4565470Z ##[debug]Attempt '1' for uploading chunk '1' of file 'Code Coverage Report_21524/Summary_1ffa78d2/coverage.cobertura.xml'.
2023-11-17T16:08:25.4565874Z ##[debug]Generate new HttpRequest for uploading file 'Code Coverage Report_21524/Summary_1ffa78d2/coverage.cobertura.xml', chunk '1' of '1'.
2023-11-17T16:08:25.4566413Z ##[debug]Start uploading file 'Code Coverage Report_21524/Summary_1ffa78d2/coverage.cobertura.xml' to server, chunk '1'.
2023-11-17T16:08:25.4566830Z ##[debug]Finished upload chunk '1' of file 'Code Coverage Report_21524/Summary_1ffa78d2/coverage.cobertura.xml', elapsed 185 (ms), response code 'Created'.
2023-11-17T16:08:25.4573414Z File upload succeed.
2023-11-17T16:08:25.6780689Z Published 'C:\agent\_work\_temp\6e7c069e-180d-4400-9a88-bec1a986e9aa' as artifact 'Code Coverage Report_21524'.
2023-11-17T16:08:25.6788842Z ##[debug]PERF : CoverageProcesser.PublishHTMLReport : took 6237.8749 ms.
2023-11-17T16:08:25.7007931Z ##[debug]Exit code 0 received from tool 'C:\agent\_work\_tasks\PublishCodeCoverageResults_2a7ebc54-c13e-490e-81a5-d7561ab7cd97\2.229.0\node_modules\coveragepublisher\CoveragePublisher\CoveragePublisher.Console.exe'
2023-11-17T16:08:25.7013740Z ##[debug]STDIO streams have closed for tool 'C:\agent\_work\_tasks\PublishCodeCoverageResults_2a7ebc54-c13e-490e-81a5-d7561ab7cd97\2.229.0\node_modules\coveragepublisher\CoveragePublisher\CoveragePublisher.Console.exe'
2023-11-17T16:08:25.7085678Z ##[section]Finishing: Publish code coverage

@rikrak
Copy link
Author

rikrak commented Nov 17, 2023

Possibly related to #19221

@calohmn
Copy link

calohmn commented Feb 6, 2024

I have a pipeline that builds a .NET Framework project and runs MSTests, collecting code coverage using the NuGet package coverlet.collector (V6.0.0). The coverage results are published using the PublishCodeCoverageResults@2 task[1]

The coverage results are published to the pipeline successfully, which is great.
When I look at the Code Coverage tab on the build summary, I see a very basic report. There is, however, a more detailed report uploaded as a build artifact called "Code Coverage Report_" which is far more useful. Is there any way of having this displayed as the default coverage report?

Note: Could be related to #19221

We are also seeing this behaviour. The strange thing is, that while the pipeline is still running, the Code Coverage tab displays the detailed report with links to individual file result pages - as it should be.
Only after the pipeline has finished, the basic report is shown in the Code Coverage tab.

A StackOverflow page with the same observation presents the fixing of a wrong pathToSources value as solution.
But in our case, the pathToSources value seems correct - the source links in the Code Coverage Report_<BuildId> artifact are correct.

@rochapablo
Copy link

+1

@marcoatribeiro
Copy link

Same issue here. I had to rollback to V1 task to make the detail report visible again. And, even so, it took me a while to figure out I had to add disable.coverage.autogenerate: true variable to display dark mode report.

@Antiohne
Copy link

Based on the reactions of the senior program manager in the post New version of Publish Code Coverage Results task:

View actual source code:

Thanks for raising this. To view the actual source code of the file with lines being marked as covered or not is something we may support in the future. It is not in place now for the V2 task yet as that is not compatible with additional features supported by the V2 task. For example, the build quality checks done on individual folders.

Usage of ReportGenerator:

Yes, the current gap between V1 and V2 (missing line and branch based coverage) is because the V2 does not use the report generator internally. There were issues with report generator for larger repositories and that is one of the reasons to move away from that.

Branch based code coverage:

We do plan to look into supporting the branch based code coverage in the V2 task.

Gap between v1 and v2:

We do expect to close the gap between the V2 and V1. Mainly the line based coverage. The V2 task is not using the report generator and there are no plans to rely on that. Nonetheless there still may be benefit on the V2 task – code coverage for folders and there can be set build quality checks to ensure respective folders will meet the requirements that may differ from the overall coverage required.

@rgrace-puck
Copy link

rgrace-puck commented Apr 4, 2024

I don't understand why this huge gap in functionality going from V1 to V2 isn't documented anywhere? Especially on the official documentation page.

@damu9618
Copy link

damu9618 commented May 7, 2024

I was using reportgenerator@5 with PublishCodeCoverageResults@1 Now I have migrated to PublishCodeCoverageResults@2 without using report generator based the previous conversation in github because PublishCodeCoverageResults@2 doesn't support report generator. Post migration I don't see any results. please find reference below

  • task: PublishCodeCoverageResults@2
    displayName: Publish code coverage results
    inputs:
    pathToSources: '$(Agent.TempDirectory)/**/coverage.cobertura.xml'
    summaryFileLocation: '$(Build.SourcesDirectory)/${{ parameters.resultsDirectory }}/coverage.cobertura.xml'
    condition: succeededOrFailed()
    Please let me know incase if anyone has the working solution with V2 version?

@MTomBosch
Copy link

MTomBosch commented May 14, 2024

Check this link: danielpalme/ReportGenerator#646 (comment)
It shows you a way getting the rich html coverage report back without even using the PublishCodeCoverageResults task at all.
It is a shame for MS that an external person has to provide the solution that everybody is in need for.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants