Question

I want to stop further execution of Tests within a TestFixture if one of them fails in NUnit.

Of course the common and advised practice is to make tests independent of each other. However, the case I would like to use NUnit for, requires that all tests and test fixtures following one that failed, are not executed. In other words, test failure causes the whole NUnit execution to stop (or proceeds with the next [TestFixture] but both scenarios should be configurable).

The simple, yet not acceptable solution, would be to force NUnit termination by sending a signal of some kind to the NUnit process.

Is there a way to do this in an elegant way?

Was it helpful?

Solution

I believe you can use NAnt to do this. Specifically, the nunit or nunit2 tasks have a haltonfailure parameter that allows the test run to stop if a test fails.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top