azure-pipelines-tasks: [REGRESSION]: PublishCodeCoverageResults@2 not generating branch coverage information

New issue checklist

Task name

PublishCodeCoverageResults

Breaking task version

1.236.1

Last working task version

1.231.0

Regression Description

When combined with the BuildQualityChecks@7 downstream, previously one would be able to enforce both line coverage AND branch coverage. Now, it reports 0% branch coverage.

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

Ubuntu 22.04

Relevant log output

[WARNING] Coverage data does not include the requested coverage of type 'branches'. Please ensure that your coverage tool is able to report this type of coverage data!
##[warning]Coverage data does not include the requested coverage of type 'branches'. Please ensure that your coverage tool is able to report this type of coverage data!
Total branches: 0
Covered branches: 0
Code Coverage (%): 0
[ERROR] The code coverage value (0%, 0 branches) is lower than the minimum value (70%)!
##[error]The code coverage value (0%, 0 branches) is lower than the minimum value (70%)!


### Full task logs with system.debug enabled

_No response_

### Repro steps

_No response_

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 15
  • Comments: 23 (1 by maintainers)

Most upvoted comments

Can you at least roll back the deprecation warning until you’ve solved this?

It looks like branch coverage is now appearing in the report on “Code Coverage” tab (which is good), but still not available for BuildQualityChecks to check. I’m seeing this:

Using IdentifierJobResolver
Validating code coverage policy...
Successfully read code coverage data from build.
Evaluating coverage data from 1 filtered code coverage data sets...
[WARNING] Coverage data does not include the requested coverage of type 'branches'. Please ensure that your coverage tool is able to report this type of coverage data!
##[warning]Coverage data does not include the requested coverage of type 'branches'. Please ensure that your coverage tool is able to report this type of coverage data!
Total branches: 0
Covered branches: 0
Code Coverage (%): 0

Still not able to get the branch coverage using v2

While it works for ‘line’ coverage, it won’t work for ‘branches’. Can this be fixed with priority, please? The only workaround is rolling back to V1 and ADO pipelines will show the message to upgrade to V2. Thanks.

Any updates on this? BuildQualityChecks still seems not to work with v2: ##[warning]Coverage data does not include the requested coverage of type ‘branches’. Please ensure that your coverage tool is able to report this type of coverage data!

Based on the comment below on the original Azure DevOps blog, I retried the PublishCodeCoverageResults@2 task. Branch and line coverage is working again for me.

https://devblogs.microsoft.com/devops/new-pccr-task/?commentid=4652#comment-4652

If it’s working for other folks, maybe this regression can be closed?

I’m getting the following warning in every build:

##[warning]New V2 version of task publishing code coverage results is available to all our customers now. We highly recommend to stop using the V1 version and migrate to V2 version (https://learn.microsoft.com/azure/devops/pipelines/tasks/reference/publish-code-coverage-results-v2). For more details, see - https://devblogs.microsoft.com/devops/new-pccr-task.

But how I suppose to switch to the new version if it doesn’t work properly?

What @syre described is our exact same experience for us on the Azure SDK for C++ CI pipelines (from this project).

What do we need to do to get this actually on the product backlog? I’ve already rolled back to v1 which implores you to upgrade to v2. If you’ve moved on to GitHub actions, fine. But at least address regressions.

We are having the same issue, when in the “Code Coverage” tab drilldown into files does not work to see line/branch coverage. However when downloading the “Code Coverage Report” from “artifacts”, drilldown works just fine.

we are having the same issue. when I migrate v2, no branch coverage created. rolled back my changes until v2 version have a branch coverage.

Same for me and also with V1 I cloud check which methods that have coverage and see the source code also.

I am also facing a similar issue, in @1 version we were able to see line, branch and method coverage. but in @2 version we are only getting line coverage. By when we can expect this available in @2 version?

Hi guys do we have any update on this? We are having the same issue, thanks

We are seeing the same issue today after we moved to PublishCodeCoverageResults@2. In the task log, there was no branch results:

Publishing coverage summary data. line- 124 of 124 covered. Publishing file coverage data.

The v1 published both line and branch results:

Publishing coverage summary data to TFS server. Lines- 124 of 124 covered. Branches- 28 of 28 covered. Modifying Cobertura Index file Publishing code coverage files to TFS server. Uploading 7 files