I ended up creating one test method by sequence I wanted to test and it works 
well.

Frédéric THOMAS

> From: webdoubl...@hotmail.com
> To: dev@flex.apache.org
> Subject: RE: [FlexUnit] More than 1 SequenceRunner.addAssertHandler ?
> Date: Thu, 19 Jun 2014 17:35:17 +0100
> 
> Actually, unfortunately, it seems it is the same, I still need help on it 
> then:
> 
> 
> 
>     [Test(async, description="Verify the Thread State sequence 
> New->Running->Terminated")]
>     public function testNewToRunningToTerminate():void {
>         testStateNew();
> 
>         const startRunner:SequenceRunner = createStateSequenceRunner(_thread, 
> _thread.start, thread_stateRunning);
>         startRunner.run();
> 
>         const terminateRunner:SequenceRunner = 
> createStateSequenceRunner(_thread, _thread.terminate, thread_stateTerminate);
>         terminateRunner.run();
>     }
> 
>     private function createStateSequenceRunner(target:IEventDispatcher, 
> method:Function, assertHandler:Function, args:Array = null, 
> argsFunction:Function = null, timeout:int = 500):SequenceRunner {
>         const runner:SequenceRunner = new SequenceRunner(this);
> 
>         runner.addStep(new SequenceCaller(target, method, args, 
> argsFunction));
>         runner.addStep(new SequenceWaiter(target, 
> ThreadStateEvent.THREAD_STATE, timeout));
>         runner.addAssertHandler(assertHandler, null);
> 
>         return runner;
>     }
> 
> Frédéric THOMAS
> 
> > From: webdoubl...@hotmail.com
> > To: dev@flex.apache.org
> > Subject: RE: [FlexUnit] More than 1 SequenceRunner.addAssertHandler ?
> > Date: Thu, 19 Jun 2014 16:43:05 +0100
> > 
> > Well, it seems the answer is to create more SequenceRunner :P
> > 
> > Frédéric THOMAS
> > 
> > > From: webdoubl...@hotmail.com
> > > To: dev@flex.apache.org
> > > Subject: RE: [FlexUnit] More than 1 SequenceRunner.addAssertHandler ?
> > > Date: Thu, 19 Jun 2014 16:23:10 +0100
> > > 
> > > I meant, 
> > > It looks like it uses the first addAssertHandler in both cases.
> > > Frédéric THOMAS
> > > 
> > > > From: webdoubl...@hotmail.com
> > > > To: dev@flex.apache.org
> > > > Subject: [FlexUnit] More than 1 SequenceRunner.addAssertHandler ?
> > > > Date: Thu, 19 Jun 2014 16:18:27 +0100
> > > > 
> > > > Hi,
> > > > 
> > > > I'm trying to use the SequenceRunner for the first time and facing a 
> > > > problem, it seems I can't have more than one addAssertHandler by 
> > > > SequenceRunner:
> > > > 
> > > > It looks like it uses the last addAssertHandler in both cases.
> > > > 
> > > >     [Test(async, description="Verify the Thread State sequence 
> > > > New->Running->Terminated")]
> > > >     public function testNewToRunningToTerminate():void {
> > > >         testStateNew();
> > > > 
> > > >         const runner:SequenceRunner = new SequenceRunner(this);
> > > > 
> > > >         runner.addStep(new SequenceCaller(_thread, _thread.start));
> > > >         runner.addStep(new SequenceWaiter(_thread, 
> > > > ThreadStateEvent.THREAD_STATE, 2000));
> > > > 
> > > > // If I comment this one, everything works as expected.
> > > >         runner.addAssertHandler(thread_stateRunning, null);
> > > > 
> > > >         runner.addStep(new SequenceWaiter(_thread, 
> > > > ThreadResultEvent.RESULT, 2000));
> > > > 
> > > >         runner.addStep(new SequenceCaller(_thread, _thread.terminate));
> > > >         runner.addStep(new SequenceWaiter(_thread, 
> > > > ThreadStateEvent.THREAD_STATE, 2000));
> > > >         runner.addAssertHandler(thread_stateTerminate, null);
> > > > 
> > > >         runner.run();
> > > >     }
> > > > 
> > > >     private function thread_stateRunning(e:ThreadStateEvent, 
> > > > passThroughData:Object = null):void {
> > > >         testStateRunning();
> > > >     }
> > > > 
> > > >     private function thread_stateTerminate(e:ThreadStateEvent, 
> > > > passThroughData:Object = null):void {
> > > >         testStateTerminated();
> > > >     }
> > > > 
> > > > What did I miss ?
> > > > How can I manage that ?
> > > > 
> > > > Frédéric THOMAS                                           
> > >                                     
> >                                       
>                                         
                                          

Reply via email to