7 Replies Latest reply on May 8, 2010 10:33 AM by RoberEtBurke

    AIRCIListener + flexUnitTasks.jar fails on Windows

    flaircode Level 1

      When I try to run flexunit with the AIRCIListener I get:

      BUILD FAILED
      C:\...\build.xml:245: Error launching the test runner.

       

      My Ant target looks like this:

      <target name="test"
                  depends="clean, init"
                  description="Compile TestRunner.mxml as a SWF runnable by AD">

       

              <mxmlc file="${test.src.loc}/${test.application.name}"
                  configname="air"
                     output="${test.bin.loc}/${test.artifact.name}">

       

                  <compiler.source-path path-element="${src.loc}"/>
                  <compiler.source-path path-element="${test.src.loc}"/>

       

                  <!-- The TestRunner needs the flexunit libraries in the build/libs folder -->
                  <library-path dir="${build.libs.loc}"
                                append="true">
                      <include name="*.swc"/>
                  </library-path>

       

                  <library-path dir="${libs.loc}"
                                append="true">
                      <include name="*.swc"/>
                  </library-path>

       

                  <!-- Sets java.awt.headless=true so font compilation works in headless environments -->
                  <compiler.verbose-stacktraces>true</compiler.verbose-stacktraces>
                  <compiler.headless-server>true</compiler.headless-server>
              </mxmlc>

       

              <!-- Execute TestRunner.swf as FlexUnit tests and publish reports -->
              <flexunit player="air"
                        swf="${test.bin.loc}/${test.artifact.name}"
                        toDir="${report.loc}"
                        haltonfailure="false"
                        verbose="true"/>

       

              <!-- Generate readable JUnit-style reports -->
              <junitreport todir="${report.loc}">
                  <fileset dir="${report.loc}">
                      <include name="TEST-*.xml"/>
                  </fileset>
                  <report format="frames"
                          todir="${report.loc}/html"/>
              </junitreport>

          </target>

       

      I am using RC2 downloaded here: http://github.com/flexunit/flexunit/downloads

       

      When I try flexUnitTasks-4.1.0.jar which I got by checking out the sources from github I get:

      BUILD FAILED
      C:\...\build.xml:245: java.util.concurrent.ExecutionException: command [<testcase classname='com.myproject.desktop.model::DesktopModelTest' name='testSetServerUrl' time='0.000'  status='success'/>] not understood

       

      I guess this is because the SWCs are RC2 and the jar is RC1.

      When I try the RC1 SWCs with the RC1 flexUnitTasks.jar my runner hangs while executing async tests.

      So none of the combinations worked for me. I got the RC1 running for a while but when I addded more tests I got this hanger which is not caused by failures in my tests because they run fine under Mac.

      Any idea on this?

       

      Thanks,

      Sönke

        • 1. Re: AIRCIListener + flexUnitTasks.jar fails on Windows
          legrosb Level 3

          @flaircode - The mismatch in version number is what's most likely causing issues when using different versioned JARs and SWCs.  We've released FlexUnit4 Final, but for some reason the artifacts aren't available on flexunit.org for download, so I'll look into that.  For now, if you're ok running our early release of 4.1, you can download the artifacts from our CI server @ http://flexunit.digitalprimates.net:8080/view/Flex%204.0/job/FlexUnit4-Flex4/ for Flex 4 or @ http://flexunit.digitalprimates.net:8080/view/Flex%203.5/job/FlexUnit4-Flex3.5/ for Flex 3; if you're working with an earlier version, just look at http://builds.flexunit.org and choose your version of Flex.

           

          As far as the runner hanging on Windows for RC1, I haven't seen this before, so it may be a bug and a reason to try 4.1.0.  I try to test on Mac, Windows, and Linux and didn't see any issues with the SampleCIProject, but that's a very contrived example.  You say it hangs, do you notice if any of the report files are written to disk?  If so, are all of them written to disk?  Are you compiling your test SWF against both the AirCIListener.swc and CIListener.swc; the AirCIListener.swc requires the CIListener.swc to work correctly.  Are you adding the AirCIListener as a listener on the core in your test runner?  Maybe a dump of your test runner would help give me a better idea.

           

          The use of the Ant task seems to correct.  The Ant task uses the adl.exe command from your Flex SDK and creates a manifest for the test runner to execute in ADL on the fly; maybe this manifest is a bit off.  Could you provide me with the build script's output for the test target; at the least maybe just the output from the FlexUnit Ant task?

           

          Let me know what you can regarding the output and we'll dig in to see what's going on and fix your issue.  If anyone else has used the AIR test support on Windows, please free to chime in.

           

          -Brian

          • 2. Re: AIRCIListener + flexUnitTasks.jar fails on Windows
            flaircode Level 1

            Thanks for the reply!

            So now I tried 4.1.0.53-sdk4.0.0.14159.jar from your CI server and I the air app hangs like with RC2.

            Here the Console output:

             

            Buildfile: C:\foo\build.xml
            test:
                [mxmlc] Loading configuration file C:\Program Files\Adobe\Adobe Flash Builder 4 Plug-in\sdks\4.0.0\frameworks\air-config.xml
                [mxmlc] C:\foo\bin-test\CITestRunner.swf (1153625 bytes)
            [flexunit] Validating task attributes ...
            [flexunit] Generating default values ...
            [flexunit] Using the following settings:
            [flexunit]     haltonfailure: [false]
            [flexunit]     headless: [false]
            [flexunit]     display: [99]
            [flexunit]     localTrusted: [true]
            [flexunit]     player: [air]
            [flexunit]     port: [1024]
            [flexunit]     swf: [C:\foo\bin-test\CITestRunner.swf]
            [flexunit]     timeout: [60000ms]
            [flexunit]     toDir: [C:\foo\report]
            [flexunit]     verbose: [true]
            [flexunit] Setting up server process ...
            [flexunit] Starting server ...
            [flexunit] OS: [Windows]
            [flexunit] Opening server socket on port [1024].
            [flexunit] Waiting for client connection ...
            [flexunit] Launching player:
            [flexunit] Executing 'C:\Program Files\Adobe\Adobe Flash Builder 4 Plug-in\sdks\4.0.0\bin\adl.exe' with arguments:
            [flexunit] 'C:\foo\bin-test/flexUnitDescriptor.xml'
            [flexunit] The ' characters around the executable and arguments are
            [flexunit] not part of the command.
            [flexunit] Created application descriptor at [C:\foo\bin-test\flexUnitDescriptor.xml]
            [flexunit] Client connected.
            [flexunit] Setting inbound buffer size to [262144] bytes.
            [flexunit] Receiving data ...
            [flexunit] Sending acknowledgement to player to start sending test data ...

             

            The report directory contains two XMLs so yes. Some reports are written but not all. Obviously something breaks it in between.

            I think it has to do with some async tests which I have added. The tests execute fine on Mac so I don't assume the tests to be the problem.

            The tests causing the problems look like this:

             

            [Test( async )]
            public function testLogin() : void {
                        Async.proceedOnEvent( this, _model.dispatcher, LoginEvent.LOGIN );
                        _model.login( "foo", "bar", false );
                    }

             

                    [Test( async )]
                    public function testLoginEmpty() : void {
                        Async.failOnEvent( this, _model.dispatcher, LoginEvent.LOGIN, 1 );
                        _model.login( "", "", false );
                    }

             

                    [Test( async )]
                    public function testCancel() : void {
                        Async.proceedOnEvent( this, _model.dispatcher, ChromeEvent.CLOSE );
                        _model.cancel();
                    }

             

            Can I give you any more info to track this down?

             

            Thanks,

            Sönke

            • 3. Re: AIRCIListener + flexUnitTasks.jar fails on Windows
              legrosb Level 3

              @flaircode - Can you paste the code from your CITestRunner.mxml file so I can see how you've set it up?  Also, are you using a WindowedApplicaiton instead of an Application for your test runner?  Silly questions, but it's helpful to rule anything little out.  Let me know.

               

              -Brian

              • 4. Re: AIRCIListener + flexUnitTasks.jar fails on Windows
                flaircode Level 1

                The cool thing is that I have created a test case to re-produce the problem.

                 

                I could send you the whole project. Please drop me a mail to soenke.rohde @ googles email thing

                 

                Here in short:

                The model I am testing:

                package model
                {
                    import event.SomeEvent;
                   
                    import flash.events.IEventDispatcher;

                 

                    public class SomeModel
                    {
                       
                        public var dispatcher:IEventDispatcher;
                       
                        public function SomeModel()
                        {
                        }
                       
                        public function doAThing(b:Boolean):void{
                            if(b){
                                dispatcher.dispatchEvent(new SomeEvent(SomeEvent.FOO));
                            }
                        }
                    }
                }

                 

                Here the test class:

                 

                package tests
                {
                    import event.SomeEvent;
                   
                    import flash.events.EventDispatcher;
                   
                    import model.SomeModel;
                   
                    import org.flexunit.async.Async;

                 

                    public class Test1
                    {
                       
                        private var _model : SomeModel;
                       
                        [Before]
                        public function setUp() : void {
                            _model = new SomeModel();
                            _model.dispatcher = new EventDispatcher();
                        }
                       
                        [After]
                        public function tearDown() : void {
                            _model = null;
                        }
                       
                        [Test( async )]
                        public function test1() : void {
                            Async.proceedOnEvent( this, _model.dispatcher, SomeEvent.FOO);
                            _model.doAThing(true);
                        }
                       
                        [Test( async )]
                        public function test2() : void {
                            Async.failOnEvent( this, _model.dispatcher, SomeEvent.FOO, 1 );
                            _model.doAThing(false);
                        }
                       
                        [Test( async )]
                        public function test3() : void {
                            Async.proceedOnEvent( this, _model.dispatcher, SomeEvent.FOO);
                            _model.doAThing(true);
                        }
                       
                        [Test( async )]
                        public function test4() : void {
                            Async.failOnEvent( this, _model.dispatcher, SomeEvent.FOO, 1 );
                            _model.doAThing(false);
                        }
                       
                        [Test( async )]
                        public function test5() : void {
                            Async.proceedOnEvent( this, _model.dispatcher, SomeEvent.FOO);
                            _model.doAThing(true);
                        }
                       
                        [Test( async )]
                        public function test6() : void {
                            Async.failOnEvent( this, _model.dispatcher, SomeEvent.FOO, 1 );
                            _model.doAThing(false);
                        }
                       
                        [Test( async )]
                        public function test7() : void {
                            Async.proceedOnEvent( this, _model.dispatcher, SomeEvent.FOO);
                            _model.doAThing(true);
                        }
                    }
                }

                 

                When you delete test7 the build works. With 7 or more tests they always hang. Sounds really strange but that's what I am seeing on my machine and I can re-produce it all the time.

                 

                Thanks,

                Sönke

                • 5. Re: AIRCIListener + flexUnitTasks.jar fails on Windows
                  RoberEtBurke

                  This is happening to me as well, running FlexUnit ant task on Windows Vista 64-bit.  I downloaded flexunit-flexunit-4.0.0-RC2-68-g91fcfdd.zip.  Everything compiles, and I can run it through ADT on the command line, but when I run with ant task, I get this:

                   

                  [flexunit] Waiting for client connection ...
                  [flexunit] Client connected.
                  [flexunit] Setting inbound buffer size to [262144] bytes.
                  [flexunit] Receiving data ...
                  [flexunit] Sending acknowledgement to player to start sending test data ...
                  [flexunit]

                   

                  It just hangs.

                   

                  My setup looks like this:

                   

                  <?xml version="1.0" encoding="utf-8"?>
                  <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml"
                                  xmlns:flexUnitUIRunner="http://www.adobe.com/2009/flexUnitUIRunner"
                                  creationComplete="runTests();"
                                  layout="absolute">
                     
                      <mx:Script>
                          <![CDATA[
                              import org.flexunit.listeners.AirCIListener;
                              import mx.logging.LogEventLevel;
                              import org.flexunit.internals.TextListener;
                              import org.flexunit.internals.TraceListener;
                              import org.flexunit.listeners.UIListener;
                              import org.flexunit.runner.FlexUnitCore;
                               import cms.services.view.NumberViewPropertyCommandTest;
                             
                              public function runTests() : void {
                                  var core : FlexUnitCore = new FlexUnitCore();
                                 
                                  /**If you don't need graphical test results, comment out the line below and the MXML declaring
                                   the TestRunnerBase. **/
                                  //core.addListener(new UIListener(uiListener));
                                  core.addListener(new AirCIListener());
                                 
                                  /**If you would like to see text output in verbose mode, umcomment either of the follow listeners **/
                                  core.addListener( new TraceListener() ); //- For AS3 Projects
                                  //core.addListener( TextListener.getDefaultTextListener( LogEventLevel.DEBUG ) ); // - For Flex Projects
                                 
                                  core.run(NumberViewPropertyCommandTest);
                              }
                          ]]>
                      </mx:Script>
                      <!--<flexUnitUIRunner:TestRunnerBase id="uiListener" width="100%" height="100%"  />-->
                  </mx:WindowedApplication>

                   

                  I tried using WindowedApplication and just Application, but it still hangs.  I also tried running ant as admin, still hangs.

                  • 6. Re: AIRCIListener + flexUnitTasks.jar fails on Windows
                    legrosb Level 3

                    @RoberEtBurke - We've updated our bleeding edge build to fix a bug with that Sönke found when running using ADL on Windows, so worse case I can refer you to my unstable CI build on Hudson (http://flexunit.digitalprimates.net:8080/view/Contributors/job/blegros/) to download the latest 4.1.0 build.

                     

                    It's important to note that both the cilistener and aircilistener SWCs should be built against to create the TestRunner.  Can you send me how you're using the Ant task as well?   Based on what you've shown me, nothing stands out re: the setup of your test runner.  Can you show me the entire dump of the flexunit Ant tasks' output also?  Let me know.

                     

                    -Brian

                    • 7. Re: AIRCIListener + flexUnitTasks.jar fails on Windows
                      RoberEtBurke Level 1

                      The build you gave me the link to worked, thank you.