teamcity 表示找不到 MSTests 的测试 xxx

2024-01-02

在我的一生中,我花了几周的时间尝试让 Teamcity 运行我在单元测试项目中的 MSTests,这是我正在构建的解决方案的一部分,但我失败了。

下面我列出了我尝试过的各种设置组合及其结果。

我所能得到的最好的结果是,我可以让 Teamcity 了解有关我的测试的一些信息,但它找不到它们。我有tried https://stackoverflow.com/questions/8382632/how-to-get-teamcity-to-run-tests-using-mstest several https://stackoverflow.com/questions/9746917/teamcity-mstest-and-testlist 解决方案 https://stackoverflow.com/questions/24892511/configuring-mstest-with-teamcity但所有这些都有两个结果。

Here is the MSTests settings screen for reference: MsTest Settings in Teamcity

如果我指定 .vsmdi 文件的相对路径,则会得到:

[Step 7/7] Starting: C:\TeamCity\buildAgent\plugins\dotnetPlugin\bin\JetBrains.BuildServer.NUnitLauncher.exe #TeamCityImplicit
[18:00:13][Step 7/7] in directory: C:\TeamCity\buildAgent\work\5caf6e77ce7b0d2a
[18:00:14][Step 7/7] Microsoft (R) Test Execution Command Line Tool Version 12.0.21005.1
[18:00:14][Step 7/7] Copyright (c) Microsoft Corporation. All rights reserved.
[18:00:14][Step 7/7]     
[18:00:14][Step 7/7] Loading C:\TeamCity\buildAgent\work\5caf6e77ce7b0d2a\XXXX.Engine\XXXX.Engine.vsmdi...
[18:00:16][Step 7/7] Starting execution...
[18:00:16][Step 7/7] Test Check_blah_blah cannot be found.
[18:00:16][Step 7/7] Test blah_blah2 cannot be found.
[18:00:16][Step 7/7] No tests to execute.
[18:00:16][Step 7/7] Process exited with code 0

etc. So it knows有什么测试,但无法运行它们! :(

来自互联网的其他解决方案,例如(1)为单元测试项目执行 MSBuild 步骤,(2)指定 .testsettings 文件的路径(3)仅指定程序集列表(4)将我自己的值作为 mstest 的路径.exe 而不是 teamcity 环境变量。 (5) 创建测试列表并指定它...等它们都会导致以下结果:

[Step 4/4] Starting: C:\TeamCity\buildAgent\plugins\dotnetPlugin\bin\JetBrains.BuildServer.NUnitLauncher.exe #TeamCityImplicit
[17:54:50][Step 4/4] in directory: C:\TeamCity\buildAgent\work\ccf38e24ca82b24
[17:54:58][Step 4/4] No assemblies, run configuration and test metadata were found (THIS LINE VARIES BASED ON MY SETTINGS BUT the rest is the same)
[17:55:01][Step 4/4] Microsoft (R) Test Execution Command Line Tool Version 10.0.30319.1
[17:55:01][Step 4/4] Copyright (c) Microsoft Corporation. All rights reserved.
[17:55:01][Step 4/4]     
[17:55:01][Step 4/4] Please specify tests to run, or specify the /publish switch to publish results. 
[17:55:01][Step 4/4] For switch syntax, type "MSTest /help"
[17:55:01][Step 4/4] Process exited with code 1
[17:55:01][Step 4/4] Step RunTests (MSTest) failed

这个东西应该如何配置?我有什么明显的遗漏吗?或者也许是一些愚蠢的事情?

请帮忙!


我认为你的问题可能是包含测试的 dll 的路径。您在根目录中指定了 dll,这意味着它应该在签出目录中找到。如果您在 TC 上构建 dll,则这是不可能的。我们的测试设置如下:

因此我们告诉 TC 在当前配置目录的所有子目录中查找任何测试 dll。我们不使用 .vsmdi 文件来列出测试,所以我不确定这是否有效,但这就是我首先尝试的

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

teamcity 表示找不到 MSTests 的测试 xxx 的相关文章

随机推荐