exactly what does NUnit do when it encounters a timeout? I used to think he would abort the test by throwing a TimeoutException, but this test proves otherwise:
[Test, Timeout(100), ExpectedException(typeof(TimeoutException))] public static void RaisingExpectedTimeoutException() { Thread.Sleep(500); }
Unfortunately, the nunit console reports only a timeout violation, but not how the test was interrupted by it. is there anyone who knows more about how this will work? and why the above test did not raise the TimeoutException that I was expecting? (although this is a type of .NET exception, I decided that NUnit used this exception for timeout violations).
PS: this testing method also fails:
[Test, Timeout(100), ExpectedException(typeof(ThreadAbortException))] public static void RaisingExpectedThreadAbortException() { Thread.Sleep(500); }
and this testing method succeeds ("no one expects the Spanish Inquisition!"):
[Test, ExpectedException(typeof(ThreadAbortException))] public static void ThrowingExpectedThreadAbortException() { Thread.CurrentThread.Abort(); }
c # nunit timeoutexception
mtijn
source share