CruiseControl 和 MSTest:如果测试失败,构建也会失败
我正在尝试将 MSTest(Visual Studio 2010 版本)集成到 Cruise Control 中。我可以让测试报告显示在构建报告中,包括显示失败的测试。然而,即使测试失败,CruiseControl 构建仍然“成功”(例如,在 CCTray 中,构建“变绿”)。在构建网页中,它显示“套件运行:0”、“测试运行:0”等。
我希望这样,如果测试失败,构建就会失败(即“变红”)。
我在网上进行了搜索,并遵循了我能找到的每一条建议,但无济于事。任何帮助和/或建议将不胜感激。提前致谢! :)
I am trying to integrate MSTest (Visual Studio 2010 version) into Cruise Control. I can get the Test Report to show up in the Build Report, including showing tests that failed. However, even though tests are failing, the CruiseControl build still 'succeeds' (for instance, in CCTray, the build 'goes green'). In the Build Web Page, it says 'Suites run: 0', 'Tests run: 0', etc.
I would like it so that if a test fails, the build fails (i.e., 'goes red').
I have searched all over the web, and followed every piece of advice I can find, to no avail. Any help and/or advice would be greatly appreciated. Thanks in advance! :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
部分问题在于
msbuild.exe
在测试完成(而不是测试通过)时返回"true"
退出代码 ($?)。您需要检查 *.trx
结果文件中的ResultsSummary
部分(特别是计数器"passed"
和"executed"< /代码>)。
例如,
Jenkins
有一种方法将 *.trx
转换为它自己的 (jUnit
) 格式来解释这些。我有一个批处理脚本,它运行指定输出文件的 MSTEST,然后检查以下内容是否失败,然后以非零状态退出(这将使 Jenkins 知道测试失败):
Part of the problem is that
msbuild.exe
returns a"true"
exit code ($?) on test completion (rather than test passed). You need to examine the *.trx
results file for theResultsSummary
section (specifically the counters"passed"
and"executed"
).e.g.
Jenkins
has a way of converting *.trx
to it's own (jUnit
) format for interpreting these.I've got a batch script which runs MSTEST specifying the output file while is then checked with the following for failures and then exits with a non-zero status (which will let Jenkins know that the test failed):