2015-06-30 17 views
2

对于我的生活,我想为Teamcity运行MSTests几周,我在我的单元测试项目中,这是我正在构建的解决方案的一部分,我失败了。teamcity说测试xxx不能用于MSTests

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

我得到的最好的是我可以尽可能让TeamCity知道我的测试,但它找不到它们。我有triedseveralsolutions但所有这些都有两个结果。

这里是设置屏幕,以供参考MSTests: 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 

等,所以它知道什么测试有,但不能运行它们! (

其他解决方案来自interwebs像(1)为单元测试项目做一个MSBuild步骤,(2)指定.testsettings文件的路径(3)仅指定程序集列表(4)将自己的值的路径,而不是TeamCity的环境变量的mstest.exe(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 

如何这个东西应该是配置?有什么明目张胆的我失踪?或者可能是愚蠢的东西?

请帮助!

回答

3

我认为你的问题可能是包含测试的dll的路径。你有根指定的dll,这意味着它的期望是在结帐目录中找到。如果你正在TC上构建D​​LL,那么这是不太可能的。我们有测试设置是这样的:

enter image description here

所以我们告诉TC在当前的配置目录的所有子目录,寻找任何测试的DLL。我们不使用.vsmdi文件列出测试,所以我不确定这是否会起作用,但这就是我想先尝试

+0

啊哈!现在有一个线索! :)我会尝试一下。 – gideon

+0

谢谢,完美无缺。我知道这是问了一下,但我还有一个第二个问题,你会介意在这里检查它:http://stackoverflow.com/questions/31183858/copying-to-teamcitys-out-directory-before-running-unit-测试?lq = 1 – gideon

+0

没问题。我也这样做:) –