teamcity complains Test xxx cannot be found for MSTests

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: http://i.stack.imgur.com/HQpnR.png

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! (Oh and I've cross posted on stackoverflow here)

3 comments
Comment actions Permalink

Hi,

TeamCity just launches MSTest.exe with command line parameters. Please try to run MSTest via command line with the same parameters in the same working directory. Do the tests run successfully?

0
Comment actions Permalink

So it turns out I just needed to put in a relative path using the %...checkoutDir% env
var.

My unit tets run but:

Many tests fail because there needs to be a config file alongside the unittests.dll once it's built and ready to run.

I've written a simple `Command Line` step with:

>> copy %system.teamcity.build.checkoutDir%\xx.configfile <destination>

The destination is the problem, I need it to be the Out directory teamcity creates.

TC creates `SYSTEM_<machinename> <datetime>\OUT`. An example:

    C:\TeamCity\buildAgent\temp\buildTmp\SYSTEM_GIDEON 2015-07-02 16_51_09\Out

In there is my unittests.dll and I want to copy my config file there. What environment var or (anything else) can I use in the command line script? I can't seem to find an env variable to refer to this output dir.

I'm using Teamcity 9.0.2

0
Comment actions Permalink

Please see the related forum thread https://devnet.jetbrains.com/message/5541408#5541408 and try the suggested solution.

0

Please sign in to leave a comment.