• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

Sequence Runner and Signals

Community Beginner ,
Jun 17, 2011 Jun 17, 2011

Copy link to clipboard

Copied

I've got a unit test where I want to test reading from a local sqlite database.  Obviously I need to write a record before I can read it.  I've written the sequence below but I'm getting an "Asynchronous Event Received out of Order" error:

[Test(async)]

public function testRead():void

{

     LOG.info("testRead()");

     var runner:SequenceRunner = new SequenceRunner(this);

     var signal:SignalAsync = new SignalAsync(SERVICE.createSignal);

     runner.addStep(new SequenceCaller(SERVICE, SERVICE.create, [person]));

     runner.addStep(new SequenceWaiter(signal, SignalAsyncEvent.CALLED, 1000));

     var signal2:SignalAsync = new SignalAsync(SERVICE.readSignal);

     runner.addStep(new SequenceCaller(SERVICE, SERVICE.read, [person._id]));

     runner.addStep(new SequenceWaiter(signal2, SignalAsyncEvent.CALLED, 1000));

     registerFailureSignal(this, SERVICE.errorSignal);

     handleSignal(this, SERVICE.readSignal, testReadResultHandler, 3000, person);

     runner.run();

}

Since SequenceWaiter required an event I created a new SignalAsync which fires a SignalAsyncEvent when the signal is triggered by my service.  I'm sure I'm doing this totally wrong so any help would be great. The person object is created when the test beings.

Thanks,

Brent

TOPICS
FlexUnit

Views

1.1K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 17, 2011 Jun 17, 2011

Copy link to clipboard

Copied

Oh I'm using FlashBuilder 4.5.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 30, 2011 Aug 30, 2011

Copy link to clipboard

Copied

LATEST

Rather than using Signals, why don't you just nest your Sequences that you want to run? Something like this:

var sr1:SequenceRunner=new SequenceRunner(this);
var sr2:SequenceRunner=new SequenceRunner(this);

//add some sequence steps to sr1 here

sr1.addStep(new SequenceWaiter(someEventDispatcher, someTriggerEvent, 10000));

sr1.addAssertHandler(

function(event:Event, passThroughData:Object):void
{

     //add some sequence steps to sr2 here

     sr2.addStep(new SequenceWaiter(anotherEventDispatcher, anotherTriggerEvent, 10000));

     sr2.addAssertHandler(

     function(event:Event, passThroughData:Object):void
     {

          //do some assertions here

     }

     , null);
     sr2.run();

}

, null);
sr1.run();

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines