Skip to main content
nikos101
Inspiring
January 5, 2011
Question

Testing a service that returns an AsyncToken

  • January 5, 2011
  • 1 reply
  • 2953 views

I have a working test that tests a service that returns an AsyncToken. I am using AsyncResponder instead of any of the Aysnc Flexunit stuff. Is this OK?

One thing I don't get is that the passthroughData get passed to the onResult method, even though AsyncResponder doesn't pass on anything other than the event.

    [Test(async)]

        public function testAttemptLogin():void

        {

      var token: AsyncToken = objectToTest.attemptLogin('k');

     token.addResponder(new AsyncResponder(onResult, faultHandler));

        }

        private function onResult(event:ResultEvent,passthroughData:Object):void {

//assertions

            }

This topic has been closed for replies.

1 reply

Participating Frequently
January 5, 2011

No. This will not work.

FlexUnit has a Async.asyncResponder

method that will do what you want

Mike

nikos101
nikos101Author
Inspiring
January 5, 2011

works for me, and brings the data back