You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by Jesper Birkestrøm <je...@bluebit.dk> on 2014/04/17 09:46:46 UTC

Async testing with deferred

Hi

I am trying to write a test for my web service. I’m using flexunit and have implemented my service using https://github.com/jonnyreeves/as3-async/.
How do you continue the test without any events triggered? What would be best practice in this case?

    [Test(async, timeout="1000")]
    public function testRealBackend(member) : void {
	// TODO
	member.should().have.property(’token’);
    }    

    [Before(async)]
    public function setUp():void {
        AuthenticateService.login(‘username', ‘password')
            .completes(function(member:MemberModel) {
		//Continue with tests
            })
            .fails(function(e:Error) {
                throw new Error('Authentication backend not responding: ‘ + e.message);
            });
    }

Venlig hilsen/Best regards
Jesper Birkestrøm