Re: NUnit 2.5: What's In It Now

Gary Evans <[email protected]> Thu, 10 Apr 2008 22:29:55 +0100
Newsgroups gmane.comp.windows.dotnet.nunit.devel
Message-ID <[email protected]>




Hi Gary,
 
For example, you write 
   Assert.That( 2 + 2 , Is.EqualTo( 5) );
I'd like the test result that says "Expected: 4 But was: 5" to go back to NUnit
without throwing an AssertionException.
 
Why you ask?
 
Because then, if you wrote
  Assert.That( 2+2, Is.EqualTo( 4) );
I could give NUnit that successful result, and continue with the test.
 
Reporting of successful asserts is a long-standing request and reporting
failure via an exception seems wrong to me, since failures are expected
in a test framework.
 
That would not change how other exceptions are reported, however.
 
Any ideas?
 
 
Charlie
 
I like this :) it is a bit limiting that an assertion failure prevents the rest of the test from running, in some cases. I say some cases 'cause a lot of tests are written at the minute that rely on this functionality.
 
If we're in a loop checking inputs against expected output, you might be interested in all of the loop results - whether successful or not. But in other tests a failure at the top of a test may mean that there's not much point carrying on.
 
But then again, maybe Assert.That should return the result of the condition, so you could have
 
if (!Assert.That(myCondition))
{
// there's not much point continuing the test
return;
}
 
Cheers,
Gary
_________________________________________________________________
Amazing prizes every hour with Live Search Big Snap
http://www.bigsnapsearch.com

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone

_______________________________________________
nunit-developer mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nunit-developer