我有两个问题。
我运行 TeamCity 6.5 构建,步骤之一是 MSTest 测试。如果 MSTest 找不到 vsmdi 文件中描述的测试,我预计测试运行会失败。
[17:47:01]: [Step 2/2] Loading (Path)\LocalTestRun.testrunconfig...
[17:47:01]: [Step 2/2] Loading (Path)\Tests.vsmdi...
[17:47:01]: [Step 2/2] Starting execution...
[17:47:01]: [Step 2/2] Test BlaBla1 cannot be found.
[17:47:01]: [Step 2/2] Test BlaBla2 cannot be found.
[17:47:01]: [Step 2/2] Test BlaBla3 cannot be found.
[17:47:01]: [Step 2/2] No tests to execute.
[17:47:07]: [Step 2/2] Process exited with code 0
我从命令行启动了 MSTest,当它找不到任何测试时,它确实返回零作为退出代码。 有谁知道在没有找到测试的情况下如何强制它失败?
我认为第二个问题与 TeamCity 更多相关。如果 MSTest 找不到 vsmdi 文件,它会打印到日志
[17:59:16]: [Step 2/2] File "(Path)\Tests.vsmdi" not found .
[17:59:16]: [Step 2/2] For switch syntax, type "MSTest /help"
[17:59:16]: [Step 2/2] Process exited with code 1
此构建配置已打开失败条件“构建进程退出代码不为零”,但该步骤不会失败。有谁知道如何处理吗?
最佳答案
有Fail build on metric change TeamCity 7.0 + 中的功能 因此,如果构建中没有报告测试,则使用 UI 设置的构建可能会失败。
关于teamcity - 当未找到测试时,MSTest 结果成功,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9905700/