|
From: Luke B. <lb...@gm...> - 2006-06-20 18:13:58
|
Don't forget that there's a big difference between asynchronous and event-driven. The synchronous test runner should support testing event-driven functionality. Occasionally, we have to build a mock object that subclasses the "class under test" and exposes the event triggering features as a test-only interface. I have often found that when I'm doing this, what I am actually testing is the EventDispatcher, not the features that I'm really interested in. But it does make sense in some cases. Usually, I will just subscribe to the event I'm interested in, change the state of the object in the test method, and call "fail()" in my event handler if the state is not expected. This should unwind properly to the output. Writing multiple test methods that work asynchronously is quite a bit more complicated with AsUnit3 because we built it over JUnit which uses exceptions to manage test status. Because of this, once we're executing a test method, we need to unwind the same thread in order to get valid results. I haven't checked out the stuff chris and others have posted, but I hope that helps. Thanks, Luke www.asunit.org |