Azure PublishCodeCoverageResults@2 issue with detailed report for coverage

169 Views Asked by At

I'm trying to switch PublishCodeCoverageResults from @1 to @2. Because appeared warnig in pipeline

##[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.

Currently, I'm using this code to obtain the report

- task: PublishCodeCoverageResults@1
  inputs:
    codeCoverageTool: 'Cobertura'
    summaryFileLocation: '$(Agent.BuildDirectory)/app_folder/coverage.xml'
  displayName: 'Publish Coverage Report'

After finishing, I receive a detailed report that allows me to go through the code and investigate the coverage.

PublishCodeCoverageResults@1 report

But when I'm trying to switch to PublishCodeCoverageResults@2

- task: PublishCodeCoverageResults@2
  inputs:
    summaryFileLocation: '$(Agent.BuildDirectory)/app_folder/coverage.xml'
    pathToSources: '$(Agent.BuildDirectory)/app_folder/'
  displayName: 'Publish Coverage Report'

and can got only common not useful report

PublishCodeCoverageResults@2 report

I've been trying different approaches according the official documentation, but eventually I didn't get detailed report and any artifacts after run.

Maybe somebody is facing with this issue. Thanks for the advice in advance.

Run tools: pytest and coverage.py

0

There are 0 best solutions below