21

I am trying to figure out how to make TeamCity run my MSTests. I have setup a build step using the following parameters:

  • Path to MSTest.exe: %system.MSTest.10.0%
  • List assembly files: Projects\Metadude..Tests\bin\Debug\Metadude..Test.dll
  • MSTest run configuration file: Local.testsettings

However when this step runs, it does not execute any tests. This is the output from the log:

[02:13:49]: Step 2/2: Run Unit Tests (MSTest)
[02:13:49]: [Step 2/2] Starting: "D:\Program Files (x86)\TeamCity\buildAgent\plugins\dotnetPlugin\bin\JetBrains.BuildServer.NUnitLauncher.exe" #TeamCityImplicit
[02:13:49]: [Step 2/2] in directory: D:\Program Files (x86)\TeamCity\buildAgent\work\1f82da3df0f560b6
[02:13:50]: [Step 2/2] Microsoft (R) Test Execution Command Line Tool Version 10.0.30319.1
[02:13:50]: [Step 2/2] Copyright (c) Microsoft Corporation. All rights reserved.
[02:13:50]: [Step 2/2]
[02:13:50]: [Step 2/2] Please specify tests to run, or specify the /publish switch to publish results.
[02:13:50]: [Step 2/2] For switch syntax, type "MSTest /help"
[02:13:50]: [Step 2/2] Process exited with code 1
[02:13:50]: Publishing internal artifacts
[02:13:50]: [Publishing internal artifacts] Sending build.finish.properties.gz file
[02:13:50]: Build finished

I have tried to specify the tests to run using the following:

  • Tests: Tests.Metadude.Core.Extensions.StringExtensionsTests

But that doesn't work. I can't seem to find any documentation on google related to the MSTest build step in TeamCity.

UPDATE Ok, I am an idiot. Well that might be a little harsh, but the test assembly was missing an "s" from the assembly name. Would have been nice to get something to that effect in the build log though.

3
  • @Leslie Hanks Which of the steps in the answer solved your issue?
    – wal
    Dec 5, 2011 at 22:47
  • @wal Well I had a typo in my assembly name. Dec 22, 2011 at 22:53
  • I am also an idiot that missed a "s" from the assembly name. It's worth triple checking :)
    – TinyRacoon
    Dec 2, 2015 at 15:57

1 Answer 1

20

Firstly, Ensure the assembly you are trying to test exists at that location.

ie

your relative path: Projects\Metadude..Tests\bin\Debug\Metadude..Test.dll

However I would expect something logged by TC if your file didnt exist. It looks like its running MSTest without any arguments somehow.

If you are sure the path is correct try it without specifying the .testsettings file to see what happens. I'm using MSTest succesfully in TC without this (but you may need it). The other thing I'm doing different is I specify the FULL path to MSTest.exe, ie

C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\MSTest.exe

instead of their variable '%system.MSTest.10.0%'

I can't recall why I did this but there would have been a good reason (like it didnt work when using their variable)

6
  • Firstly, Ensure the assembly you are trying to test exists at that location. As with @wal, it was the assembly name that got me. In my case the assembly name differed from the project name... assumptions. BTW: Nothing else gets logged by TC/MSTest.
    – Campey
    Mar 6, 2012 at 7:30
  • 6
    Since Visual Studio 2012 (at least the express versions) MsTest.exe is called vstest.console.exe and can be found at C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe
    – dwonisch
    Nov 14, 2013 at 21:03
  • TeamCity is smart and full path to mstest.exe is not needed. Sep 24, 2014 at 12:32
  • 1
    @qub1n at least 16 people disagree ??
    – wal
    Sep 24, 2014 at 12:34
  • Anyway it works for me (TeamCity 8.1.3). MStest.exe in windows cmd is not recognized, but Teamcity just work with only MSTEST.EXE. I have installed Windows 7 SDK + Build Tools. Sep 24, 2014 at 14:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.