MSTest succeeds when no tests are found
I have two questions.
I am running TeamCity 6.5 build and one of the steps is MSTest tests. And in case MSTest cannot find the tests described in the vsmdi file, I expect the test run to fail.
[17:47:01]: [Step 2/2] Download (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] BlaBla1 test not found.
[17:47:01]: [Step 2/2] BlaBla2 test not found.
[17:47:01]: [Step 2/2] BlaBla3 test not found.
[17:47:01]: [Step 2/2] There are no tests to run.
[17:47:07]: [Step 2/2] Process ended with code 0
I ran MSTest from the command line and it does return zero as its exit code when it doesn't find any tests. Does anyone know how to make it fail when no tests are found?
The second problem has more to do with TeamCity I think. In case MSTest cannot find the vsmdi file, it prints in the log
[17:59:16]: [Step 2/2] File "(Path) \ Tests.vsmdi" not found.
[17:59:16]: [Step 2/2] For switch syntax enter "MSTest / help"
[17:59:16]: [Step 2/2] Process ended with code 1
This build configuration is set to Fault: build completion code is not zero, however, this step does not complete. Does anyone know how to deal with this?
source to share
TeamCity 7.0+ has a feature called Fail build on metric change.Thus , you can crash using UI options if no tests are reported in the build.
source to share