21
votes

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.

1
@Leslie Hanks Which of the steps in the answer solved your issue?wal
@wal Well I had a typo in my assembly name.Leslie Hanks
I am also an idiot that missed a "s" from the assembly name. It's worth triple checking :)TinyRacoon

1 Answers

20
votes

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)