teamcity says Test xxx cannot be found for MSTests

你离开我真会死。 提交于 2019-12-10 18:12:16

问题


For the life of my I'm trying for weeks for Teamcity to run the MSTests I have in my a unit test project which is part of the solution I'm building but I've failed.

Below I list the various combinations of settings I've tried and their outcomes.

The best I've got is I can go as far as getting Teamcity to know something about my tests but it can't find them. I have tried several solutions but all of which have two outcomes.

Here is the MSTests settings screen for reference:

If I specify a relative path to the .vsmdi file then I get :

[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 what tests there are, but can't run them! :(

Other solutions from the interwebs like (1) Doing an MSBuild step for the unit tests project, (2) Specifying the path to the .testsettings file (3) Specifying only the assemblies list (4) Putting my own value for the path to mstest.exe instead of the teamcity env variable. (5) Creating a test list and specifying it ... etc They all result in this outcome:

[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

How is this thing supposed to be configured? Is there something blatant I'm missing? Or perhaps something silly?

Please help!


回答1:


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



来源:https://stackoverflow.com/questions/31138829/teamcity-says-test-xxx-cannot-be-found-for-mstests

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!