Re: nunit tests hold onto file handles aftertestsaredone

"Charlie Poole" <[email protected]>
Newsgroups gmane.comp.windows.dotnet.nunit.user
Message-ID <00a501c8d58a$b0d80790$6401a8c0@ferrari>
As I said, we may have the info you need available to do this in the next
release. That said,
I think a better approach would be to give the tests two different
teardowns: one to cleanup 
after success, the other after failure.
 
However, even that approach has a problem. If a single test fails and you
fail to clean up
after it, it's likely that subsequent tests won't run correctly.
 
Charlie


  _____  

From: [email protected]
[mailto:[email protected]] On Behalf Of Pigneri,
Rocco
Sent: Monday, June 23, 2008 11:34 AM
To: David Jeske
Cc: [email protected]; Charlie Poole
Subject: Re: [Nunit-users] nunit tests hold onto file handles
aftertestsaredone



This might require too much integration with NUnit, but it could be worth a
shot.  I believe that test failures are actually implemented as exceptions
(please correct me if I am wrong).  You could then put everything in a
try-catch block and only clean things up if the exception does not inherit
from the "TestFailedException".

 

Also, this sounds like it may benefit from a custom TestRunner or something
else that could wrap the tests for you.  However, I don't have enough
experience in those to say one way or the other.

 

Rocco 

 

From: David Jeske [mailto:[email protected]] 
Sent: Monday, June 23, 2008 11:56 AM
To: Pigneri, Rocco
Cc: Charlie Poole; [email protected]
Subject: Re: [Nunit-users] nunit tests hold onto file handles after
testsaredone

 

On Mon, Jun 23, 2008 at 7:14 AM, Pigneri, Rocco <[email protected]>
wrote:

In order to do this I need to be able to "ask for the name of the test which
is about to run, or just finished running, from SetUp or TearDown", and "ask
for the pass/fail result of the last test when in TearDown", alternatively,
if there is a way to ask for the pass/fail result of any test by name, I
could use the first result about the test name and then look up the test
result. 

Another possible way to solve this problem is to have the SetUp both tear
down the old test bed and build the new one.  That way, all of your test
output will be available after the run of the tests, thus allowing you to
inspect all the test output on a whim.  The one downfall to this is that
your test beds will be left around after your tests are run, which may not
work in your situation.

That's a nifty idea, I'll have to try both.

My primary issue is inability to access the information about whether the
test passed or failed. I don't want to keep all the datafiles for tests that
passed, I only want to keep the failures, so I can inspect them. I guess as
a workaround I can put the body of every test in a try/catch block, and if
it catches anything, mark the test as failed in an instance field and
rethrow the exception I caught.

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php

_______________________________________________
Nunit-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nunit-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.