Sonar的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 Cover调用中通过Gallio运行NUnit测试:
First step is to run the NUnit tests via Gallio within a dotCover cover call:
& dotCover cover `
/TargetExecutable="C:\Program Files\Gallio\bin\Gallio.Echo.exe" `
/TargetArguments="/report-type:XML /report-name-format:test-report /runner:IsolatedProcess /report-directory:.\Gallio .\Path\Test.dll" `
/Filters="+:WhatToCover" `
/Output=coverage.snapshot
Solar可以通过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
这篇关于Sonar的TeamCity dotCover报告路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!