Comment 2 for bug 730891

Revision history for this message
Charlie Poole (charlie.poole) wrote : Re: [Bug 730891] Re: GUI runner option to stop upon failure

I haven't tried the code, but it doesn't look like it should work. The Sleep
command will put the thread that sends events into a wait state. However,
that won't have any impact on the test thread. I think it will just continue
to run tests and queue events that you never see because of the Sleep.

Charlie

On Tue, Jul 12, 2011 at 3:20 PM, Nicolas Rivera
<email address hidden> wrote:
> For anyone interested, I think I found a workaround.  The following
> adding seems to do the trick:
>
>   [NUnitAddin(Description = "Stop Upon Failure")]
>   public class StopUponFailureAddIn : IAddin, EventListener
>   {
>      #region IAddin Members
>
>      public bool Install(IExtensionHost host)
>      {
>         if (host == null)
>            throw new ArgumentNullException("host");
>
>         IExtensionPoint listeners = host.GetExtensionPoint("EventListeners");
>         if (listeners == null)
>            return false;
>
>         listeners.Install(this);
>         return true;
>      }
>
>      #endregion
>
>      #region EventListener Members
>
>      public void RunFinished(Exception exception)
>      {
>      }
>
>      public void RunFinished(TestResult result)
>      {
>      }
>
>      public void RunStarted(string name, int testCount)
>      {
>      }
>
>      public void SuiteFinished(TestResult result)
>      {
>      }
>
>      public void SuiteStarted(TestName testName)
>      {
>      }
>
>      public void TestFinished(TestResult result)
>      {
>         if (result.IsError || result.IsFailure)
>         {
>            Trace.WriteLine("STOPPING TEST EXECUTION");
>            Thread.Sleep(Timeout.Infinite);
>         }
>      }
>
>      public void TestOutput(TestOutput testOutput)
>      {
>      }
>
>      public void TestStarted(TestName testName)
>      {
>      }
>
>      public void UnhandledException(Exception exception)
>      {
>      }
>
>      #endregion
>   }
>
> --
> You received this bug notification because you are subscribed to NUnit
> Framework.
> https://bugs.launchpad.net/bugs/730891
>
> Title:
>  GUI runner option to stop upon failure
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/nunit-3.0/+bug/730891/+subscriptions
>