3

I have two questions.

I run TeamCity 6.5 build and one of the steps is MSTest tests. And in case when MSTest can't find the tests described in vsmdi file, I expect that the test run fails.

[17:47:01]: [Step 2/2] Loading (Path)\LocalTestRun.testrunconfig...

[17:47:01]: [Step 2/2] Loading (Path)\Tests.vsmdi...

[17:47:01]: [Step 2/2] Starting execution...

[17:47:01]: [Step 2/2] Test BlaBla1 cannot be found.

[17:47:01]: [Step 2/2] Test BlaBla2 cannot be found.

[17:47:01]: [Step 2/2] Test BlaBla3 cannot be found.

[17:47:01]: [Step 2/2] No tests to execute.

[17:47:07]: [Step 2/2] Process exited with code 0

I launched MSTest from command line, and it really returns zero as exit code when it doesn't find any tests. Does anyone know how to force it to fail, when no tests are found?

Second problem is more connected to TeamCity, I think. In case if MSTest can't find vsmdi file, it prints to log

[17:59:16]: [Step 2/2] File "(Path)\Tests.vsmdi" not found .

[17:59:16]: [Step 2/2] For switch syntax, type "MSTest /help"

[17:59:16]: [Step 2/2] Process exited with code 1

This build configuration has Fail condition "build process exit code is not zero" turned on, nevertheless, the step doesn't fail. Does anyone know how to deal with it?

Community
  • 1
  • 1
Pavel
  • 73
  • 5

2 Answers2

1

There is Fail build on metric change feature in TeamCity 7.0 + So you could fail build using UI settings if there is no reported tests in build.

Alexander V. Ilyin
  • 2,440
  • 1
  • 16
  • 11
0

The only way I can think of is to have a somewhat complex solution. The solution is to specify a Result File name. Then the next step after the tests run should be to run a command line util that you'll write that will inspect the file to check for the absence of run tests.

Paul Mendoza
  • 5,709
  • 12
  • 53
  • 82