尝试在单个构建管道中为多个测试项目创建单个代码覆盖率报告 - 单个构建中的多个阶段。
- task: DotNetCoreCLI@2
displayName: Run Test
inputs:
command: 'test'
projects: |
$(FunctionProjectBase)/$(FunctionShortName1)/*.csproj
arguments: --configuration $(BuildConfiguration) --collect "XPlat Code coverage"
- task: PublishCodeCoverageResults@1
displayName: 'Publish code coverage report'
inputs:
codeCoverageTool: 'Cobertura'
summaryFileLocation: $(Build.SourcesDirectory)/**/coverage.cobertura.xml
- task: DotNetCoreCLI@2
displayName: Run Test
inputs:
command: 'test'
projects: |
$(FunctionProjectBase)/$(FunctionShortName2)/*.csproj
arguments: --configuration $(BuildConfiguration) --collect "XPlat Code coverage"
- task: PublishCodeCoverageResults@1
displayName: 'Publish code coverage report'
inputs:
codeCoverageTool: 'Cobertura'
summaryFileLocation: $(Build.SourcesDirectory)/**/coverage.cobertura.xml
但这不会在“代码覆盖率选项卡”Azure DevOps 上生成代码覆盖率报告。它只生成一个可下载的文件。