My goal for this build was to build the app, run unit test, make a nuget package of one of the projects and then publish the nuget package somewhere that makes sense.
I made the misstake of just using the defaults for teamcity and the default is to execute the next step only if the previous step finishes succesfully, meaning you get an exit code 0.
I even made a nice diagram for it.
See how it says Zero exit code and tests pass after the nunit step?
The two are totally different things. Even if some tests fail the exit code can and most likely will still be zero.
So if we leave this.
And get failing tests, our nuget package will still be created. Because the exit code is 0.
It is better to set this in step 3 (build the nuget package)
It will then not make a nuget package when the tests fail or the exit code is 0.
You can leave step 4 the default since the artifact won’t be created in step 3 and their will be nothing to publish anyway.
I am using teamcity 8.0, nunit 2.6 and nuget 2.6.1.