I recently found myself needing to load two external files during the setup phase of a test. Normally I'd use Async.proceedOnEvent() with something like:
[BeforeClass(async)]
public static function setUpBeforeClass():void
{
_oneRecord = new URLLoader(new URLRequest("data/OneRecord.csv"));
Async.proceedOnEvent(ZeoCSVParserTest, _oneRecord, Event.COMPLETE);
// Trying to load the second file causes problems
// _complexRecord = new URLLoader(new URLRequest("data/ComplexRecord.csv"));
// Async.proceedOnEvent(ZeoCSVParserTest, _complexRecord, Event.COMPLETE);
}
In this case adding a second Async.proceedOnEvent() doesn't work. I ended up creating an event aggregator class to handle waiting for the needed events. I was curious if there was a facility already built in that would handle this?
Hi Daniel,
You are correct that this is painful in the current infrastructure. We are working to make this easier in the next version. For now, you could either make a class that manages this as you indicated or use Sequences. The disadvantage of the latter is that it would force you to load one file, wait until it was complete and then load the next as it requires things are done in order.
Mike
Hi.
Try to implement an external dependency data loader.
External Dependency loader "preload" all information before the test start. Inside that loader you can load as many things as you want.
When you are ready call "myToken.notifyResult( event.result);" and the test will begin.
The External Dependency thought is interesting. However, I'm not
looking to parameterize the tests and for this purpose the
dataProvider syntax obscures the test's intent. For now I'm going to
stick with a helper class that just bundles the requests.
-- Daniel R. <danielr@neophi.com> http://danielr.neophi.com/
North America
Europe, Middle East and Africa
Asia Pacific