use*_*350 5 azure sonarqube azure-devops azure-pipelines sonarscanner
我使用 Azure 管道来运行单元测试和 SonarQube 集成。当我使用 cobertura 进行单元测试时,我无法将代码覆盖率结果传递到 SonarQube,尽管我在管道日志中看到结果。然而,当我使用 OpenCover 时,同样的事情也会发生。
\n我还在管道日志中看到此警告,尽管我不确定这是否相关: \xe2\x80\x9cMissingblame information for the following files\xe2\x80\x9d
\n目前的管道如下所示
\n - task: DotNetCoreCLI@2\n inputs:\n command: \xe2\x80\x98test\xe2\x80\x99\n projects: | \n <test-proj>\n arguments: \xe2\x80\x98/p:CollectCoverage=true /p:CoverletOutputFormat=cobertura\xe2\x80\x99\n displayName: \xe2\x80\x98Run Tests\xe2\x80\x99\n\n - task: SonarQubePrepare@4\n inputs: \n SonarQube: <Service-Endpoint>\n scannerMode: \xe2\x80\x98MSBuild\xe2\x80\x99\n projectKey: \xe2\x80\x98test:service\xe2\x80\x99\n projectName: \xe2\x80\x98test:service\xe2\x80\x99\n extraproperties: | \n sonar.flex.cobertura.reportPaths=$(Build.SourcesDirectory)/**/coverage.cobertura.xml \n \n - task: DotNetCoreCLI@2\n <Running DotNet build>\n\n - task: SonarAnalyze@4\n \nRun Code Online (Sandbox Code Playgroud)\n运行DotNet Test阶段时,测试结果在此路径中获得 -\n E:\\agent-5\\2\\s\\test\\ApiTest\\coverage.cobertura.xml
\n任何建议,将不胜感激。
\n更新:显然,SonarQube 默认情况下不允许发布 Cobertura 结果文件(或者至少我无法让它运行)。
使用了一种解决方法 - 我必须将 OpenCover 测试结果文件传递给 SonarQube。为了将结果推送到 Azure Devops,我必须使用 reportgenerator 工具将结果转换为 Cobertura,然后再将其传递到 Azure Devops。
| 归档时间: |
|
| 查看次数: |
9194 次 |
| 最近记录: |