7 Replies Latest reply on Nov 6, 2009 7:37 AM by riatest

    Multiple SequenceRunner dependency.




      I am using FlexUnit 4 and have a particular TestCase where i need to confirm an Alert for the Test to continue.


      I need to wait for the creation complete of this Alert or else the test crash because of a callLaterCreationComplete.


      I cannot add a sequence waiter on it when i create the test because the alert does not exist yet. I dont want to keep a reference on this alert either and its created dynamically without parent. (When we put a Parent, the Alert.show crash in flexunit 4)


      So in my case i am lucky because i can set the state of my model, with direct calls and without SequenceRunner, then afterwards, create the runner with the alert on focus.


      sequence.addStep(new SequenceWaiter((view.focusManager.getFocus() as
      UIComponent).parent.parent, FlexEvent.UPDATE_COMPLETE, 2000));
      sequence.addStep(new SequenceCaller(view, function():void {
           (view.focusManager.getFocus() as EventDispatcher).dispatchEvent(new MouseEvent(MouseEvent.CLICK));


      Now the problem: in another case i can only set the state with a SequenceRunner.


      How can i chain 2 different SequenceRunner in a test so they run one after another?


      Is using addAssertHandler to create another SequenceRunner a good option?



        • 1. Re: Multiple SequenceRunner dependency.
          mlabriola Level 4

          Well, I'm not sure it is a good option to use the assertHandler, it will work.


          FlexUnit checks after the assertHandler is done executing to see if there are any other asynchronous events pending before it declares the test complete. So, adding this second sequence here would work.



          • 2. Re: Multiple SequenceRunner dependency.
            [KitFox] Level 1

            Actually, im pretty sure its not a good option.


            But a method to support that kind of behavior is really needed.

            So the the support for multiple SequenceRunner would be official.


            Something easy could be added!

            Like a special step to the SequenceRunner : setNextRunnerCreator(sequenceRunnerCreator:Function):void




            private function createSequenceRunner():SequenceRunner {}


            Then at the very end of the run() method, just call the creator, and call his run() method

            right after and continue the tests.

            • 3. Re: Multiple SequenceRunner dependency.
              mlabriola Level 4

              I understand what you are looking for but I am not sure if that is on our roadmap right now. It seems you are going beyond what we really intended even in the integration world and are continuing to move toward functional testing. This is an interesting use case, and one that has been thrown around for a while, but there are tools such as FlexMonkey and RIATest which do a better job of functional than we will be able to do within this type of framework.


              that said, we will be introducing some new pieces over the coming months that will help a bit within this realm but I am not sure it will be exactly what you need.


              lastly, all of the sequence steps simply implement an interface as we didn't try to predict every use case someone would have. So, if this is something you find useful for your project, you can declare any type of sequence step you would like and the sequencer will execute it. So, the functionality you need would only be a handful of lines of code away.



              1 person found this helpful
              • 4. Re: Multiple SequenceRunner dependency.
                [KitFox] Level 1

                Hehe, we tryed RIATest, but with CI builds with Hudson, forget that.


                Our project may be too big, but we have no choice to find a way to do that kind

                of thing.


                Interesting with the Sequencer interface... ill take a look.

                I just hope it wont end up in recursive calls and stackOverflows.


                I really hope youll consider that feature


                Thanks for the answer!

                • 5. Re: Multiple SequenceRunner dependency.

                  Hi KitFox,


                  What's wrong with using RIATest in CI with Hudson?


                  If you let me know we might be able to fix it! :-)



                  • 6. Re: Multiple SequenceRunner dependency.
                    [KitFox] Level 1

                    Well heres the info:


                    Our hudson on the CI server run on the System user.


                    If we paste the command executed by hudson in a command prompt, everything is ok.


                    If hudson run it, the process never stops and eventually time out.


                    Started by user xxxxxx
                    Updating http://irdev-svn.xxx.local/svn/trunk/ir-app-xxx-flex-test
                    At revision 54394
                    no change for http://irdev-svn.xxx.local/svn/trunk/ir-app-xxx-flex-test since the previous build
                    [workspace] $ cmd /c call C:\WINDOWS\TEMP\hudson682.bat
                    C:\ir-depot\hudson\jobs\dsirdev-xxx-trunk-riatest-itg\workspace>C:\ir\RIATest3\riatest.exe --batch --timelimit=1800 errorlimit=3 --run --project=C:\ir-depot\hudson\jobs\dsirdev-xxx-trunk-riatest-itg\workspace\ir-app-xxx-flex-test\src\main\resources\Saphir.rtp --output-xml=xxx-67.xml --launch=ie --define="appURL=http://intranet-ir-itg.xxx.local/ir-xxx-web/RIATestLoader.html?rtLoadURL=xxx.swf"  
                    C:\ir-depot\hudson\jobs\dsirdev-xxx-trunk-riatest-itg\workspace>exit 1 
                    Finished: FAILURE
                    • 7. Re: Multiple SequenceRunner dependency.
                      riatest Level 1

                      Thanks, KitFox.


                      I will see if there is anything we can do about it.