Hi,
There is the doc page about FlexUnit4's async approach: http://docs.flexunit.org/index.php?title=Writing_an_AsyncTest
Here is the concept that's confusing for me:
// timer is a Timer instance set to tick once with a delay of TIMER_TIME.
[Test(async)]
public function testAsync() : void {
var asyncHandler:Function = Async.asyncHandler( this, handleTimerComplete, ASYNC_TIME, null, handleTimeout );
timer.addEventListener(TimerEvent.TIMER_COMPLETE, asyncHandler, false, 0, true );
timer.start();
}
handleTimerComplete is called when the timer object is completed (after TIMER_TIME). It only happens when TIMER_TIME < ASYNC_TIME. handleTimeout called if asyncHandler is completed (after ASYNC_TIME). It happens if ASYNC_TIME < TIMER_TIME.
It's really doesn't make sense to me. I'd expect to call a test function periodically with a time limit, and as soon as the test succeed the periodical call should complete successfully. On the other hand I'm not sure where to put the actions (what I want to test) and where to put the tests (asserts).
Is there a more detailed documentation or an example that clarify the approach?
Thanks!