Re: nunit tests hold onto file handles after tests aredone
"David Jeske" <[email protected]>
| Newsgroups | gmane.comp.windows.dotnet.nunit.user |
|---|---|
| Message-ID | <[email protected]> |
On Thu, Jun 19, 2008 at 11:10 AM, Charlie Poole <[email protected]> wrote: > NUnit does have some current problems of not releasing objects, which are > fixed in the source. Some of those /could/ relate to your file problems, but > there really is no guarantee that files not closed explicitly will be closed > between NUnit runs. This makes some kinds of applications a bit hard to > test. > Reloading the project fixes my problems (presumably because it unloads the assembly, which either accidentally, or deliberatly causes a GC). However, the only setting in the nunit GUI is to "reload before each test run". This is the opposite of what I want. I would need it to "reload after the tests are complete", to force it to unload everything. Is there some reason it can't do this? It might even be sufficient just to force a full GC after it drops the handles to the instantiated test objects. I suppose the right thing to do is hack the nunit gui source and see if I can fix my problems. > The simplest way to do what you want for a test directory is to delete > and recreate it in SetUp or TestFixtureSetUp. In that case, it will always > be there between tests, whether they pass or not. If you additionally want > to delete some files when the tests pass, you currently have to put the > delete at the end of each test. > I see the SetUp/TearDown hooks, but I was hoping for something that would let me get information about the test that is about to run or just finished running. (what is it called, what was the result) For example, I would create a setup which would create a fresh directory with the same name as the test, and let the test run. Then in TearDown, if the test passed, I would leave the directory in tact (so I could look at the bad data inside it), but if the test passed, I would delete and clean it up so it wasn't cluttering the directory. 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. How would I ask those questions in Nunit? or is there no way to do that? Riddling my otherwise clean tests with a bunch of boilerplate finalizers and junk just doesn't seem right. Perhaps I'll look at making an extension or patch if this can't be done today. ------------------------------------------------------------------------- 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