我需要通过build.yml文件为在VSTS中运行的单元测试用例设置代码覆盖率百分比。 现在,对于即将到来的任何代码覆盖率百分比,构建都可以通过。 如果百分比不是70%,我想限制它并使构建失败。 你能帮我吗? ...
提示:本站收集StackOverFlow近2千万问答,支持中英文搜索,鼠标放在语句上弹窗显示对应的参考中文或英文, 本站还提供 中文繁体 英文版本 中英对照 版本,有任何建议请联系yoyou2525@163.com。
我目前正在为我的存储库设置azure管道。 当前,它可以正确构建并运行单元测试。 但是,“代码覆盖率”选项卡只是无限旋转。 任何会导致这种情况的想法吗?
详细资料 :
工件目录如下所示:
控制台显示此错误:
错误:找不到路由ID ms.vss-tfs-web.project-overview-route的路由。 确保将请求的路由添加到路由共享数据中。
这是运行和生成测试结果的方式:
dotnet tool install dotnet-reportgenerator-globaltool --tool-path .
dotnet test $(Build.SourcesDirectory)\RulesMadeEasy.Tests -c debug --logger trx --no-restore /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura --results-directory $(Build.SourcesDirectory)\TestResults\ /p:CoverletOutput=$(Build.SourcesDirectory)\TestResults\
.\reportgenerator -reports:$(Build.SourcesDirectory)\TestResults\coverage.cobertura.xml -targetdir:$(Build.SourcesDirectory)\TestResults\ -reporttypes:"HTMLInline_AzurePipelines;Badges" --version 4.0.0-rc4
使用PublishCodeCoverageResults @ 1任务和以下输入输入来发布代码覆盖率结果:codeCoverageTool:Cobertura
summaryFileLocation: '$(Build.SourcesDirectory)\TestResults\coverage.cobertura.xml'
reportDirectory: '$(Build.SourcesDirectory)\TestResults'
您必须在Azure DevOps项目中启用Boards服务,以使错误消失。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.