Question
Verifying a list of same events
Hi,
I am writing a test method to verify playing a list of video. Each time a video is played, player sends "playing" event out. So my code would just listen for that event from the player. In addition, player implementation is asynchronous by nature. The issue here is that if i code test method like the following, flexunit does not wait for event to occur before executing next loop iteration.
public function testPlaying10Videos():void
{
for (var i:int = 0; i < 10; i++)
{
var uuid:String = TestHelper.getRandomVideoId();
Player.Instance.addEventListener(Event.Playing,
addAsync(verifyVideoPlaying,
60000,
uuid,
errorVideoNotPlaying));
Player.Instance.callMethod("vidPlayId", uuid);
}
}
Any idea how to overcome this issue?
Thanks,
Dina
I am writing a test method to verify playing a list of video. Each time a video is played, player sends "playing" event out. So my code would just listen for that event from the player. In addition, player implementation is asynchronous by nature. The issue here is that if i code test method like the following, flexunit does not wait for event to occur before executing next loop iteration.
public function testPlaying10Videos():void
{
for (var i:int = 0; i < 10; i++)
{
var uuid:String = TestHelper.getRandomVideoId();
Player.Instance.addEventListener(Event.Playing,
addAsync(verifyVideoPlaying,
60000,
uuid,
errorVideoNotPlaying));
Player.Instance.callMethod("vidPlayId", uuid);
}
}
Any idea how to overcome this issue?
Thanks,
Dina
