Comment 5 for bug 730891

Revision history for this message
Nicolas Rivera (nick4christ) wrote : Re: GUI runner option to stop upon failure

There is a more flexible way to do this that I just found out about.

In TearDown() one could write:

if (TestContext.CurrentContext.Result.Status == TestStatus.Failed)
  { Thread.Sleep(Timeout.Infinite); }

The problems with that approach are:

1. The error call stack does not get printed in the "Error and Failures" tab (which makes sense, since TearDown() has not completed). Ideally the CurrentContext would include the exception also, so that the call stack could be output to the "Text Output" tab.
2. Thread.Sleep(Timeout.Infinite) does not allow the GUI to close cleanly, so the process has to be killed through task manager. Ideally there would be a way to tell any NUnit client (whether GUI or console) to stop running a batch of tests from inside teardown.

Could the above two changes be considered instead of my original feature request? I rather like those than a GUI-centric feature. Plust they allow for a higher control and granularity than a simple global GUI setting to "Stop Upon Failure".

Are TextContexts something carried over to NUnit 3.0?