Skip to main content
Participant
Aug 30, 2008 3:55 AM UTC
Question

addAsync in setUp()

I would like to add an async function inside the setUp() of a test, but FlexUnit generates an error to the effect that the function argument is not a function. Is running async function in a setUp() supported? I would appreciate any advice on this.

Basically, what I'm trying to do is to perform some end-to-end testing of business methods inside FlexUnit, and those methods need to call methods on the server. Because the methods alter state on the server, I want to be able to clear up any changes to server-side state performed during the tests. Thus, I need to invoke remote methods inside the setUp() methods of a test suite; and I need to ensure that each test case executes only after the setUp() method receives events from the remote method indicating successful return.

Again, I'd very much appreciate any suggestions as to how this may be achieved.

Thanks,

-- Frank
This topic is closed to new replies. Start a new post to keep the conversation going.

2 replies

Participant
Oct 7, 2008 12:28 PM UTC
I've logged a feature request for this:
https://bugs.adobe.com/jira/browse/FXU-20
Translate
Participant
Sep 5, 2008 10:40 AM UTC
You can use the following:

package tests {
import flash.net.URLLoader;
import flash.net.URLRequest;

import flexunit.framework.TestResult;
import flexunit.framework.TestSuite;

public class ViewTests extends TestSuite {
private var _result:TestResult;

override public function runWithResult(result:TestResult):void {
_result = result;

// Do any upfront stuff here.
var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, completeHandler);
loader.load(new URLRequest("config.xml"));
}

private function completeHandler(event:Event):void {
super.runWithResult(_result);
}
}
}
Translate