TeamCity - Stop build when a test fails

As you noted, TeamCity can run no further build steps on test failures in NUnit tests with "Only if build status is successful" step execution condition. However, that does not make the tests run stop until the step finish.

A related feature request is TW-23766.

The only workaround I can consider currently is not to use NUnit test runner and implement the logic inside the build script. For example, with nunit-console.exe like Manuel noted. If you choose to follow this route, consider using TeamCity Addin for NUNit.


You can do it using nunit-console.exe. accordingly to the official documentation (http://nunit.org/index.php?p=consoleCommandLine&r=2.6.2) it provides a /stoponerror switch that does exactly what you need.

it can also generate an XML output that can be parsed by teamcity (there is a build feature for that) in order to populate the "test" tab.