1

I am using dotnet cake for building and testing a solution. Everything works fine and code coverage report is properly generated.

However, when creating a PR in Azure Devops, the code coverage checks is running but then disappears without any error. This only happens when using collector XPlat Code Coverage, PR code coverage check is working fine when using collector Code coverage (generating .coverage file).

Based on the documentation that should be working fine, but it does not.

Here is how the pipeline looks:

      - pwsh: dotnet cake ./scripts/build.cake --target=Test
        displayName: Run Tests

      - task: PublishTestResults@2
        displayName: "Publish Test Results"
        inputs:
          testResultsFormat: "VSTest"
          testResultsFiles: "**/*.trx"

      - task: PublishCodeCoverageResults@1
        inputs:
          codeCoverageTool: "Cobertura"
          summaryFileLocation: "$(Agent.TempDirectory)/**/*.cobertura.xml"

Test results and coverage are successfully published azure-devops-coverage published-artifacts-coverage

41D0
  • 161
  • 5

1 Answers1

0

Unfortunately, at the moment Azure DevOps supports only the use of a .coverage file:

From Code coverage for pull requests:

While you can collect and publish code coverage results for many different languages using Azure Pipelines, the code coverage for pull requests feature discussed in this document is currently available only for .NET and .NET core projects using the Visual Studio code coverage results format (file extension .coverage). Support for other languages and coverage formats will be added in future milestones.

After that, remember that you need to set a branch policy.

Gioce90
  • 554
  • 2
  • 10
  • 31