← Back to team overview

nunit-core team mailing list archive

[Bug 591335] Re: NUnit-Addin: Commands at the beginning of a test are called before the TestStarted event method

 

The EventListener methods are called asynchronously, without any
guarantee of ordering except among the calls themselves. Specifically,
there is no guarantee that the test has not yet started when TestStarted
is called.

This is because the intent of the interface is to allow reporting on
tests, without permitting any disruption or other influence on the tests
themselves.

In your case, based on the method names, I imagine that you are creating
a combined report using some info generated in the addin and other info
from the calls within the test. You can only do this if you avoid making
any assumptions as to ordering of the events. This is hard to do, of
course, if you need the info to appear in some particular order. Can you
simply call your Snapshot method from the addin itself?

Charlie

PS: It's best to have discussions on the nunit-discuss list rather than
using the bug report system. This will be more helpful to you anyway,
since more eyes will be on the problem.

-- 
NUnit-Addin: Commands at the beginning of a test are called before the TestStarted event method
https://bugs.launchpad.net/bugs/591335
You received this bug notification because you are a member of NUnit
Developers, which is subscribed to NUnit V2.

Status in NUnit V2 Test Framework: Invalid

Bug description:
Hi NUnit team,

I am writing a NUnit addin and I am wondering why the TestStarted event method is called after MemUnitClient.Snapshot() and 
MemUnitClient.Snapshot("in unit test 1 before stress") in UnitTest1() (see listing below). For me it is importand that the TestStarted method is called and executed first.
Do you have any idea?
I am using NUnit 2.5.5 with Visual Studio 2005 (C#) with GUI runner. I had the same problem with NUnit 2.5.3.


// implemented in the NUnit addin DLL
public void TestStarted(TestName testName)
{
       // do something
}


// implemented in the Unit-Test-Assembly DLL
[Test]
public void UnitTest1()
{
            MemUnitClient.Snapshot();
            MemUnitClient.Snapshot("in unit test 1 before stress");
            Stress(500000);
            MemUnitClient.Snapshot("in unit test 1 after stress");
            
	   // do something
}


It would be great if you have an idea, because it is part of my master's thesis.... :)

Thank you in advance.....it would be nice hearing from you.

Sebastian





Follow ups

References