对于我的生命,我正在为Teamcity尝试运行MSTests几周,我在我的单元测试项目中,这是我正在构建的解决方案的一部分,但我失败了。
下面我列出了我尝试过的各种设置组合及其结果。
我得到的最好的是,我可以让Teamcity了解我的测试,但找不到它们。我有tried several solutions,但所有这些都有两个结果。
以下是MSTests设置屏幕供参考:
如果我指定.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
等。所以它知道有什么测试,但无法运行它们! :(
来自互联网的其他解决方案,例如(1)为单元测试项目执行MSBuild步骤,(2)指定.testsettings文件的路径(3)仅指定程序集列表(4)为我自己设置值mstest.exe的路径,而不是teamcity env变量。 (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
这件事应该如何配置?有什么明显的东西我不见了吗?或者也许是愚蠢的事情?
请帮忙!
答案 0 :(得分:3)
I think your problem is probably the path to the dlls containing the tests. you have the dll specified at the root, which means its expected to be found in the checkout directory. If you are building the dll's on TC then this is unlikely. We have the test set up like this:
so we are telling TC to look in all subdirectories of the current config directory for any test dlls. We don't use .vsmdi files to list the tests so I'm not sure if this will work, but that's what I'd try first