teamcity - 当未找到测试时,MSTest 结果成功

标签 teamcity mstest

我有两个问题。

我运行 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/

相关文章:

linux - 处于断开连接状态的 Teamcity 构建代理

git - git force push 之后的 Teamcity

msbuild - VSTS Build 无法运行 NUnit 测试

wpf - 使用 siteoforigin 包 Uri 单元测试 WPF 应用程序

.net - AgentRestart.dat 的用途是什么

c# - 如何在解决方案中运行所有测试

java - 如何在构建步骤中配置自动提交

msbuild - 如何防止 NuGet 在还原包时询问覆盖文件?

git - TeamCity 触发 pull 请求与触发 merge

c# - 如何断言字符串列表中的任何字符串是否包含在实际字符串中