Вот полный, очень простой пример класса теста.
package test
{
import flash.events.Event;
import org.flexunit.asserts.assertEquals;
import org.fluint.sequence.SequenceRunner;
import org.fluint.sequence.SequenceWaiter;
public class test_case
{
[Test(async)]
public function test_function():void
{
var counter:Object = { count: 0}
var sr:SequenceRunner = new SequenceRunner(this);
sr.addStep(new SequenceWaiter(new TestWaiterTarget(counter), "myEvent", 50000));
sr.addStep(new SequenceWaiter(new TestWaiterTarget(counter), "myEvent", 5000))
sr.addAssertHandler(test_function_handler, counter);
sr.run();
}
private function test_function_handler(event:Event, passthroughData:*):void
{
assertEquals(passthroughData.count, 2);
}
}
}
import flash.events.Event;
import flash.events.EventDispatcher;
import flash.events.TimerEvent;
import flash.utils.Timer;
class TestWaiterTarget extends EventDispatcher
{
var timer:Timer = new Timer(250, 1);
private var _counter:Object;
public function TestWaiterTarget(counter)
{
_counter = counter;
timer.addEventListener(TimerEvent.TIMER_COMPLETE, timer_timerCompleteHandler);
timer.start();
}
private function timer_timerCompleteHandler(event:TimerEvent):void
{
_counter.count++;
dispatchEvent(new Event("myEvent"));
}
}