| Newsgroups |
gmane.comp.windows.dotnet.nunit.user |
| Message-ID |
<E961123C01E7E94AA29163941172913E053626DB@mail1.dundee.realtimeworlds.com> |
Charlie,
Thanks for getting back to me so quickly. No I don't think I explained
myself properly. We have a lot of tests so when we run NUnit seems to
spawn off thread's (maybe from a system threadpool I guess), is this
correct.
My problem is then when those threads get created but the test itself is
using a class with a ThreadStatic variable and either the [Setup] or
[TearDown] methods make a change to that threadstatic variable then they
are doing it in the main thread and not the spawned threads from nunit
because it's threadstatic. This in turn gives problems for the tests.
Perhaps I'm not making myself clear, I'll attempt to draw it out or
write a bit of test code which replicates the problem if this is
unclear.
Thanks,
Robbie
From: [email protected]
[mailto:[email protected]] On Behalf Of Charlie
Poole
Sent: 08 April 2008 17:29
To: [email protected]
Subject: Re: [Nunit-users] Threadstatic Problem
Hi Robbie,
If I'm understanding correcty, you are creating a thread in your test
and running some code on it. Since
NUnit has already run the setup at that point, there's not much to do
about it. If I'm misunderstanding,
please follow up and I'll try again.
Charlie
________________________________
From: [email protected]
[mailto:[email protected]] On Behalf Of
[email protected]
Sent: Tuesday, April 08, 2008 8:20 AM
To: [email protected]
Subject: [Nunit-users] Threadstatic Problem
We're seeing a strange problem with some unit tests to do with
NUnit's Setup and Teardown methods. The global setup and teardown
(TestFixtureSetUp, TestFixtureTearDown) gets executed on the primary
thread. However if the test case is run on a secondary thread the
function level setup/teardown (Setup, Teardown) are called on the
primary thread.
This is resulting (in what looks like) a problem with a
[ThreadStatic] attribute as the function level teardown can't touch it
correctly because it's on a separate thread.
Should the function level setup/teardown methods be called on
the functions thread and not the primary? Or am I not understanding
something properly (likely J)
Thanks,
____________________________________________________________________
DISCLAIMER
This message and any attachments contain privileged and
confidential information intended for the use of the addressee named
above. If you are not the intended recipient of this message, you are
hereby notified that any use, dissemination, distribution or
reproduction of this message is prohibited. Please note that we cannot
guarantee that this message or any attachment is virus free or that it
has not been intercepted and amended. The views of the author may not
necessarily reflect those of Realtime Worlds Ltd.
Realtime Worlds Ltd is registered in Scotland, number 225628.
Registered Office: 152 West Marketgait, Dundee, DD1 1NJ.
____________________________________________________________________
This email has been scanned by the MessageLabs Email Security System
____________________________________________________________________
DISCLAIMER
This message and any attachments contain privileged and confidential information intended for the use of the addressee named above. If you are not the intended recipient of this message, you are hereby notified that any use, dissemination, distribution or reproduction of this message is prohibited. Please note that we cannot guarantee that this message or any attachment is virus free or that it has not been intercepted and amended. The views of the author may not necessarily reflect those of Realtime Worlds Ltd.
Realtime Worlds Ltd is registered in Scotland, number 225628. Registered Office: 152 West Marketgait, Dundee, DD1 1NJ.
-------------------------------------------------------------------------
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-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nunit-users