I am testing timerevent with flex unit. Follwing is the code which i tried , it always goes to cmdFailed function (Time out function).I am new to flex unit .any help would be greatly appreciated.
[Before]
public function setUp():void
{
timer = new Timer(12000);
}
[Test(async,order=1)]
public function teststorapidpresenter():void
{
timer.addEventListener(TimerEvent.TIMER_COMPLETE,Async.asyncHandler(this,cmdHandler,20000,null,cmdFailed));
timer.start();
}
private function cmdHandler(event:TimerEvent,passThroughData:Object):void
{
}
private function cmdFailed(event:Event):void
{
fail("Event not dispatched");
}
Yes, classic error here. By default, repeatCount property of a timer is 0. That means the time never stops so the TIMER_COMPLETE is never dispatched.
timer.repeatCount = 1
and it should work