3

I'm trying to establish continuous integration with TeamCity and stuck at running unit tests step with Visual Studio Tests runner.

Loading [02:42:07]C:\TeamCity\buildAgent\work\f7a05248f49c57a1\LodCore\UserPresentationTests\bin\Release\UserPresentationTests.dll...

[02:42:07][Step 3/3] Starting execution...

[02:42:07][Step 3/3] No tests to execute.

All tests are discoverable, when I build test assemblies from Visual Studio. I've downloaded UserPresentationTests.dll from build agent to my computer and tried to execute same command with my local MSTest.exe, and it failed with the same issue. I've decompiled it with ILSpy and found no difference with dll built from Visual Studio. I've tried different build configurations on MSBuild, but it is not working.

My TeamCity version: Professional 2017.2 (build 50574)

Now my build configuration looks like that

Tests step looks like this

Community
  • 1
  • 1
Sovent
  • 119
  • 2
  • 13

3 Answers3

4

If you are using MSTest v2, then you should use VSTest instead of MSTest:

enter image description here

Peska
  • 3,980
  • 3
  • 23
  • 40
  • How could we know that VsTest newer? The article you link to is interesting, it is not mentioning is not teamcity. Could you elaborate on when to use vstest and when to use mstest? – dampee Aug 16 '18 at 22:44
  • I don't remember where I read about it, but basically as a rule of thumb, you should use: for MSTest v1 => `mstest.exe`, for MSTest v2 => `vstest.console.exe`, for .net core projects => `dotnet test`. Adding support for MSTest v2 to `mstest.exe` was rejected in this ticket: https://github.com/Microsoft/vstest/issues/1213 – Peska Aug 26 '18 at 13:14
0

Can you check that there aren't any differences between the environments in terms of installed libraries, permissions, etc.

We have a couple pointers to troubleshoot the differences between a working local build and a failing TeamCity one, you might want to follow those steps: https://confluence.jetbrains.com/display/TCD10/Common+Problems#CommonProblems-BuildfailsorbehavesdifferentlyinTeamCitybutnotlocally

With this in mind, while the step 3 is the one pointing at the failure, I'd also check the build log of step 2, as it might have skipped some of the build parts for some reason.

Also it would be helpful if you could also add to the OP the TeamCity version you are using and the type of runner you are using in step 3.

  • There is a problem: TeamCity does not log the exact command it executes to build solution, so I can't use recommendations you've provided to identify error. It runs its own plugin and does not reveal what command parameters it uses on MSBuild.exe Btw, I've added information you've mentioned, I hope it helps – Sovent Jan 11 '18 at 10:07
0

In addition of build configuration your solution you should create new configuration with Runner type MSTest. Example here

Anton Gorbunov
  • 1,414
  • 3
  • 16
  • 24
  • I have certainly created this build step and information message from OP is a part of this step output. – Sovent Jan 11 '18 at 10:13
  • @Sovent, Hi. 1. Can you show screenshots of start testing step and `General Settings` of Configuration 2. Are have project special icon (with flask) in visual studio? – Anton Gorbunov Jan 11 '18 at 10:27
  • yes, project has flask icon in visual studio. I've added test configuration screenshot to op, but general settings look, well, pretty general, there is nothing that can affect build process – Sovent Jan 15 '18 at 15:47