Issue with Async.registerFailureEvent - ExpectAsync.as

6 views
Skip to first unread message

fr1n63

unread,
Jul 20, 2010, 5:54:51 AM7/20/10
to Flexunit Contributors
Hey, I've been playing with async tests, more specifically handling
IO_Errors and stuff like that, but I've found an issue surrounding the
report generation...

Basically - the ant error is...

java.util.concurrent.ExecutionException: Error parsing report.

And the part of the report causing it is...

<testcase classname="TwitterTest" name="testData" time="30"
status="failure"><failure message="Failing due to Async Event [Event
type="IO_ERROR" bubbles=false cancelable=false eventPhase=2]"
type="TwitterTest.testData" ><![CDATA[]]></failure></testcase>

Note the Event type is wrapped in double quotes.

So I've had a dig around and found it's in the ExpectAsync class, I've
resolved it for my self by wrapping the event to message with a regex.

public function failOnComplete( event:Event,
passThroughData:Object ):void {
var message:String = "Unexpected event received ";
if ( event ) {
message += escapeEvent( event );
}

sendComplete( new AssertionError( message ) );
}

private function handleAsyncErrorFired( event:AsyncEvent ):void {
var message:String = "Failing due to Async Event ";
if ( event && event.originalEvent ) {
message += escapeEvent( event.originalEvent );
}

sendComplete( new AssertionError( message ) );
}

private function escapeEvent(event:Event):String
{
var regExp:RegExp = new RegExp('"', 'g');

return event.toString().replace(regExp, "'");
}

It's now working, not sure if it was something I was doing wrong in
the first place or if I'm missing something obvious, but this kinda
does the trick for me.

Martin

Michael Labriola

unread,
Jul 20, 2010, 9:50:57 AM7/20/10
to Flexunit Contributors
Thanks Martin. Could you create an issue in jira for this with this
information?

Mike

fr1n63

unread,
Jul 22, 2010, 6:32:25 AM7/22/10
to Flexunit Contributors
K, all done and in Jira for you - enjoy!
Reply all
Reply to author
Forward
0 new messages