3

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: MsTest Settings in Teamcity

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!

Community
  • 1
  • 1
gideon
  • 19,329
  • 11
  • 72
  • 113

1 Answers1

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:

enter image description here

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

Sam Holder
  • 32,535
  • 13
  • 101
  • 181
  • Aha! Now there's a clue! :) I'm going to try it out. – gideon Jun 30 '15 at 15:03
  • Thank you, worked perfectly. I know it's asking a bit but I have a secondary problem still, would you mind checking it out here : http://stackoverflow.com/questions/31183858/copying-to-teamcitys-out-directory-before-running-unit-tests?lq=1 – gideon Jul 02 '15 at 12:04
  • No problem. I do this as well :) – Sam Holder Jul 02 '15 at 12:18