views:

84

answers:

1

We are using NUnit to run a large number of integration tests.

All these tests share a base class, which as a test fixture setup method that preps the data needed for the rest of the tests.

Is there any way to stop running tests if there is a failure in the test fixture setup?

Right now it waits until all the tests fail with the same setup error

+2  A: 

If I understand you correctly can't you just throw an exception somewhere in your [Setup] method or [SetupFixture] class if you encountered a failure?

The test runner will still report as if all of your tests failed, but don't let that confuse you into thinking they were run. NUnit will effectively terminate as soon as it encounters the exception.

Kurt Schindler
The exception is coming from one of the methods in the test. NUnit is not terminating immediately, it takes more or less same amount of time to see the failure report compared to all passing tests.
well, I spoke too soon. Your answer made me look at the error messages much closely. There were some integration tests that are not making use of the base setup class. And each one of those tests are making the same call as setup code, which take a good amount of time to return.. Thanks.