Run a test suite (scenario) on a RemoteObject
Hi,
I'm trying to run a test suite on a remote object.
It works fine, but i want to do a "scenario" with async request.
Here is my source :
[Test(async)]
public function ping():void
{
//_proxyTest.addEventListener(FaultEvent.FAULT, Async.asyncHandler(this, onNotWantFaultEvent, SHORT_TIME, null, onWantTimeOut), false, 0, true);
Async.failOnEvent(this, _proxyTest, FaultEvent.FAULT);
_proxyTest.addEventListener(ResultEvent.RESULT, Async.asyncHandler(this, onWantResultEvent, SHORT_TIME, null, onNotWantTimeOut), false, 0, true);
_proxyTest.ping();
}
[Test(async)]
public function pingTimeOut():void
{
Async.failOnEvent(this, _proxyTest, ResultEvent.RESULT);
_proxyTest.addEventListener(FaultEvent.FAULT, Async.asyncHandler(this, onWantFaultEvent, SHORT_TIME, null, onWantTimeOut), false, 0, true);
_proxyTest.pingTimeOut();
}
/*
Handlers
*/
// ResultEvent and FaultEvent
protected function onWantResultEvent( event:ResultEvent, passThroughData:Object ):void
{
}
protected function onNotWantResultEvent( event:ResultEvent, passThroughData:Object ):void
{
Assert.fail("Request return result");
}
protected function onWantFaultEvent( event:FaultEvent, passThroughData:Object ):void
{
}
protected function onNotWantFaultEvent( e:FaultEvent, passThroughData:Object ):void
{
Assert.fail("Request fault : " + e.message );
}
// Timeout
protected function onWantTimeOut( passThroughData:Object ):void
{
}
protected function onNotWantTimeOut( passThroughData:Object ):void
{
Assert.fail('Request timeout');
}
My idea is to execute the pingTimeOut test after the end of ping Test. Because i am listening same event on the two tests (result event).
Could you propose a solution ?
Thanks
Mikael
