1 person found this helpful
General answer on the result, more details when I can look at the code.
You can still get that result object, but you need to do so once the test finish. There is an event on the core for this.
Basically, in FlexUnit4 we are broken across flash player frames and everything is potentially async, so we can't return the result object synchronously. We can only do it once the test have finished execution.
That makes sense. I was poking around the code a bit already and all I could find were basic string dispatches. There was some internal guys in core called notifier and some asyncListener which seemed to deal with result, but I didn't see anywhere it would actually dispatch anything with the result from core itself.
I am pretty sure there is another way to, but, you can def use the addListener() method of the core to add an object of type IRunListener, which will be notified as things change. Two of the methods of that interface are testRunStarted and testRunFinished which are called before anything starts and after everything finishes. Again, I think there is another event in there too we added for some UI work, but that one I am sure about (so long as my memory serves me correctly)
Alright, got it working, but I'm semi confused on what's there. Here's the class I implemented to get the result:
public class ResultCapturingRunListener extends RunListener
public function ResultCapturingRunListener()
override public function testRunFinished(result : Result) : void
this.result = result;
Looks like there are 3 classes that already implement IRunListener that I've seen. The above RunListener and two classes that extend RunListener, TextListener and TraceListener.
Here's the part thats baffling me... RunListener is the class that declares the result member, but none of the mentioned classes actually set it, making the above class necessary. Am I missing something, or would everyone who wants the result declared in the concrete RunListener have to extend it as I have? Seems that this functionality should be built in as RunListener is declaring the variable?
In any case, I have it working the way I'd like. Thanks for the help!
It sounds like a bug. The base RunListener should set it at test completion.
It is quite common that other classes may not need that result persisted, but that functionality should exist in the base class.