我记得在 NUnit Runner 失败的旧版本 Team City 中这样做,所以我尝试使用命令行运行器运行 NUnit。
我认为 Command Line Runner 设置中有一个选项可以让您指定输出文件的类型:NUnit result.xml 就是其中之一。这样做,您可以在 Web GUI 中看到测试结果分割,就像 NUnit Runner 工作时一样。
但是我在最新的 Team City (6.5.5) 中没有看到这一点。还能做吗?
PS:在有人问之前,我不能使用 Team City 的 NUnit Runner,因为 NUnit 有一个 bug这将在即将推出的 2.6.0 版本中修复。运行 nunit-console 时不会出现上述错误
最佳答案
这可以使用 importdata
来完成TeamCity 消息,当您从 MSBuild 脚本手动执行 nunit-console.exe 运行 NUnit 测试时,这非常有用,例如使用 NUnit MSBuild Community Task
,但请记住,TeamCity 提供了内置的 NUnit 测试运行器,因此您不需要这种低级 TeamCity 脚本。无论如何,您可以通过这种方式导入报告:
<Message
Text="##teamcity[importData type='nunit' path='...\TestResults.xml']"
Importance="High"/>
见 Importing XML Reports
If you prefer to run code coverage, code inspection, test tools or duplicate finders directly from build script, not as a build runner, you can use the importData service messages to import generated xml reports into TeamCity.
关于command-line - 处理 NUnit result.xml 并将其显示在 Team City Web GUI 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8057544/