nunit-core team mailing list archive
-
nunit-core team
-
Mailing list archive
-
Message #01034
[Bug 577156] Re: SimpleTestRunner miss handles point of exception
** Tags added: framework
--
SimpleTestRunner miss handles point of exception
https://bugs.launchpad.net/bugs/577156
You received this bug notification because you are a member of NUnit
Developers, which is subscribed to NUnit V2.
Status in NUnit Test Framework: Triaged
Status in NUnit V2 Test Framework: Triaged
Bug description:
The SimpleTestRunner performs a an odd skip of Exception processing when faced with a fully un-implemented EventListener. What happens is that my RunStarted throws an Exception and this gets caught end then RunFinished is called which then throws an exception -- the stack trace makes it look like the RunFinished was the culprit when in fact the RunStart began the exceptional behavior. This occurs mainly because the catch( Exception exception ) catches everything. Perhaps what it should do is catch NUnit exceptions and throw all other exceptions -- I'm not familiar enough with the architecture around Exception testing, Assert Exceptions, etc.
So here is the culprit code in SimpleTestRunner, Line 141, of release 2.5.5.101112.
public virtual TestResult Run( EventListener listener, ITestFilter filter )
{
try
{
log.Debug("Starting test run");
// Take note of the fact that we are running
this.runThread = Thread.CurrentThread;
listener.RunStarted( this.Test.TestName.FullName, test.CountTestCases( filter ) );
testResult = test.Run( listener, filter );
// Signal that we are done
listener.RunFinished( testResult );
log.Debug("Test run complete");
// Return result array
return testResult;
}
catch( Exception exception )
{
// RunStart actually threw the exception. so RunFinish doesn't make sense.
// RunFinish then throws an exception when really the first exception should be handled first.
// Signal that we finished with an exception
listener.RunFinished( exception );
// Rethrow - should we do this?
throw;
}
finally
{
runThread = null;
}
}
Cheers,
L-
References