ReportGenerator缺少代码覆盖率选项卡(Azure DevOps Server 2019.0.1)

时间:2019-07-04 10:41:08

标签: azure-devops

我遵循Computing code coverage for a .NET Core project with Azure DevOps and Coverlet的步骤。

构建运行符合预期,并且每个步骤都成功结束。

Build results

Artefact-Explorer显示了上传的报告,总之,我得到了代码覆盖率结果。

CodeCoverage result

但是我错过了 Tests 标签旁边的 Code Coverage 标签来查看详细的报告。

配置YAML:

- task: NuGetToolInstaller@0

  displayName: 'Use NuGet 5.0.2'

  inputs:

    versionSpec: 5.0.2
    checkLatest: true


- task: NuGetCommand@2

  displayName: 'NuGet restore'

  inputs:

    restoreSolution: '$(Parameters.solution)'


- task: VSBuild@1

  displayName: 'Projektmappe **\*.sln erstellen'

  inputs:

    solution: '$(Parameters.solution)'  
    platform: '$(BuildPlatform)'
    configuration: '$(BuildConfiguration)'


- task: VisualStudioTestPlatformInstaller@1

  displayName: 'Installer für Visual Studio Test-Plattform'
  enabled: false



- task: VSTest@2

  displayName: 'VsTest - testAssemblies'

  inputs:

    testAssemblyVer2: |
     **\$(BuildConfiguration)\*test*.dll
     !**\obj\**

    codeCoverageEnabled: true
    platform: '$(BuildPlatform)'
    configuration: '$(BuildConfiguration)'



- powershell: ./'D:\AzureDevOpsData\Skripte\PowerShell\CodeCoverage.ps1'

  displayName: 'PowerShell Test Code Coverage'



- task: Palmmedia.reportgenerator.reportgenerator-build-release-task.reportgenerator@4

  displayName: ReportGenerator

  inputs:

    reports: coverage.cobertura.xml
    targetdir: '$(Build.SourcesDirectory)/CodeCoverage'



- task: PublishCodeCoverageResults@1

  displayName: 'Code Coverage veröffentlichen von $(Build.SourcesDirectory)/CodeCoverage/Cobertura.xml'

  inputs:

    codeCoverageTool: Cobertura
    summaryFileLocation: '$(Build.SourcesDirectory)/CodeCoverage/Cobertura.xml'
    reportDirectory: '$(Build.SourcesDirectory)/CodeCoverage'

PowerShell脚本包含:

#TEST CSPROJ
$csproj = "FrameworkA_Tests"

#SEARCH TEST CSPROJ.DLL
"`nrun tests:"
$unitTestFile = gci -Recurse | ?{ $_.FullName -like "*bin\*$csproj.dll" }
Write-Host "`$unitTestFile value: $unitTestFile"

#GET COVERLET.EXE
$coverlet = "D:\AzureDevOpsData\Tools\coverlet\coverlet.exe"

#RUN COVERLET.EXE
"calling $coverlet for $($unitTestFile.FullName)"
&$coverlet $unitTestFile.FullName --target "dotnet" --targetargs "vstest $($unitTestFile.FullName) --logger:trx" --format "cobertura"

我忘记了什么吗?

2 个答案:

答案 0 :(得分:0)

答案 1 :(得分:0)

  

ReportGenerator缺少代码覆盖率选项卡(Azure DevOps Server 2019.0.1)

这应该是开发者社区中的一个已知问题:

Code coverage tab missing in Azure DevOps Server

MS小组答复:此问题的修复程序已在内部实施,正准备发布。

作为解决方法,您可以尝试使用jingzhu yan提供的方法:

  

您可以添加复制文件并发布构建结果步骤,然后可以   从Artifacts下载覆盖结果文件。

enter image description here

enter image description here

希望这会有所帮助。