azure-pipelines-tasks: PublishCodeCoverageResultsV1 cannot handle multiple coverage files

Type: Feature

Enter Task Name: PublishCodeCoverageResultsV1

list here (V# not needed):

Environment

  • Server - Azure Pipelines

  • Agent - Hosted

Issue Description

I have a .NET Core project which has multiple tests projects in the solution. Each test project creates a cobertura.xml code coverage file, made by coverlet.

When I run the PublishCodeCoverageResultsV1 task it fails to ‘know’ that I have multiple files and just picks the first one.

Expected Results: The task is smart enough to merge all files FIRST, then PROCESS the summary file SECOND.

Error/Warning log:

This is the warning in the log file:

##[warning]Multiple file or directory matches were found. Using the first match: /home/vsts/work/1/s/CodeCoverageResults/1fd2623f-e60a-4f9a-b3e0-2d4df53f6440/coverage.cobertura.xml

Sample logs:

Starting: PublishCodeCoverageResults
==============================================================================
Task         : Publish code coverage results
Description  : Publish Cobertura or JaCoCo code coverage results from a build
Version      : 1.160.4
Author       : Microsoft Corporation
Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/test/publish-code-coverage-results
==============================================================================
##[warning]Multiple file or directory matches were found. Using the first match: /home/vsts/work/1/s/CodeCoverageResults/1fd2623f-e60a-4f9a-b3e0-2d4df53f6440/coverage.cobertura.xml
/usr/bin/dotnet /home/vsts/work/_tasks/PublishCodeCoverageResults_2a7ebc54-c13e-490e-81a5-d7561ab7cd97/1.160.4/netcoreapp2.0/ReportGenerator.dll -reports:**/*.xml -targetdir:/home/vsts/work/_temp/cchtml -reporttypes:HtmlInline_AzurePipelines
2020-08-20T03:47:12: Arguments
2020-08-20T03:47:12:  -reports:**/*.xml
2020-08-20T03:47:12:  -targetdir:/home/vsts/work/_temp/cchtml
2020-08-20T03:47:12:  -reporttypes:HtmlInline_AzurePipelines
2020-08-20T03:47:14: Writing report file '/home/vsts/work/_temp/cchtml/index.html'
2020-08-20T03:47:14: Report generation took 1.9 seconds
Generated code coverage html report: /home/vsts/work/_temp/cchtml
Reading code coverage summary from '/home/vsts/work/1/s/CodeCoverageResults/1fd2623f-e60a-4f9a-b3e0-2d4df53f6440/coverage.cobertura.xml'
Async Command Start: Publish code coverage
Publishing coverage summary data to TFS server.
 Lines- 352 of 3960 covered.
 Branches- 69 of 1337 covered.
Modifying Cobertura Index file
Publishing code coverage files to TFS server.
Uploading 173 files
Total file: 173 ---- Processed file: 96 (55%)
File upload succeed.
Published '/home/vsts/work/_temp/cchtml' as artifact 'Code Coverage Report_3911'
Async Command End: Publish code coverage
Finishing: PublishCodeCoverageResults

Thank you kindly!

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Reactions: 12
  • Comments: 17 (1 by maintainers)

Most upvoted comments

Confusingly, in the documentation (which references v1 of the task), the text under “Arguments” for summaryFileLocation claims that merging is supported.

(Required) Path of the summary file containing code coverage statistics, such as line, method, and class coverage. Multiple summary files will be merged into a single report. The value may contain minimatch patterns. For example: $(System.DefaultWorkingDirectory)/MyApp/**/site/cobertura/coverage.xml

(emphasis mine)

Only further down the page in the FAQ does it say it’s not supported, leading to conflicting statements.

I got confused by the same thing… I decided to still give it a try and it did seem to generate correct aggregated coverage report. The only downside I am seeing now is the annoying warning ([warning]Multiple file or directory matches were found. Using the first match)… MSFT never hesitates to surprise me, this time it seems to be in a good way, though.

Hey little bot, why would you close an issue when it is not fixed?

Confusingly, in the documentation (which references v1 of the task), the text under “Arguments” for summaryFileLocation claims that merging is supported.

(Required) Path of the summary file containing code coverage statistics, such as line, method, and class coverage. Multiple summary files will be merged into a single report. The value may contain minimatch patterns. For example: $(System.DefaultWorkingDirectory)/MyApp/**/site/cobertura/coverage.xml

(emphasis mine)

Only further down the page in the FAQ does it say it’s not supported, leading to conflicting statements.

Are there any plans to implement the coverage file merging any time soon? We really need this. This is a crucial feature.