声纳的 TeamCity dotCover 报告路径 [英] TeamCity dotCover report path for Sonar
问题描述
我正在尝试将声纳分析集成到 TeamCity 构建过程中.我有一个 NUnit 构建步骤,它运行我的单元测试,然后运行 dotCover 进行覆盖.
I'm trying to integrate the sonar analysis into by TeamCity build process. I have a NUnit build step which runs my unit tests and then runs dotCover for the coverage.
我的下一步是声纳跑步者.当前存在的配置是;gallio.mode=dotCover, sonar.gallio.mode=reuseReport 但我还需要 sonar.gallio.reports.path.
My next step is the sonar-runner. The configuration that currently exists is; gallio.mode=dotCover, sonar.gallio.mode=reuseReport but I also need sonar.gallio.reports.path.
有人知道上一步生成的dotCover报告的路径吗?
Does anybody know the path to the dotCover report generated in the the previous step?
推荐答案
我找不到使用内置 NUnit 运行器的方法.我设法通过使用 powershell 构建步骤手动调用所需的命令来使其工作.
I couldn't find a way to do this using the built in NUnit runner. I managed to get it working by using a powershell build step to manually call the required commands.
第一步是在 dotCover 封面调用中通过 Gallio 运行 NUnit 测试:
First step is to run the NUnit tests via Gallio within a dotCover cover call:
& dotCover cover `
/TargetExecutable="C:Program FilesGallioinGallio.Echo.exe" `
/TargetArguments="/report-type:XML /report-name-format:test-report /runner:IsolatedProcess /report-directory:.Gallio .PathTest.dll" `
/Filters="+:WhatToCover" `
/Output=coverage.snapshot
Sonar 可以使用reuseReport 获取Gallio 测试报告,TeamCity 会自动检测测试结果.
The Gallio test report is then available to be picked up by Sonar with reuseReport, TeamCity automatically detects the test results.
您可以通过编写 服务消息到标准输出:
You can make TeamCity directly process the coverage snapshot by writing a service message to standard output:
Write-Host "##teamcity[importData type='dotNetCoverage' tool='dotcover' path='coverage.snapshot']"
要将覆盖信息转换为 Sonar 可用的格式,您需要使用 dotCover 报告命令和 未记录的报告类型 TeamCityXML:
To get the coverage info into a format usable by Sonar you need to use the dotCover report command and the undocumented report type TeamCityXML:
& dotCover report /Source=coverage.snapshot /Output=coverage-report.xml /ReportType=TeamCityXML
这篇关于声纳的 TeamCity dotCover 报告路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!