3 Replies Latest reply on Mar 8, 2011 2:02 PM by acastrucc

    Running unit tests from ant: flashplayer window remains open

    acastrucc Level 1

      I'm trying to run flex unit tests from ant but I can't get the flashplayer window to close afterwards. What am I doing wrong?

       

      <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                      xmlns:s="library://ns.adobe.com/flex/spark"
                      xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"
                      xmlns:adobe="http://www.adobe.com/2009/flexUnitUIRunner"
                      creationComplete="onCreationComplete()">
           <fx:Script>
               <![CDATA[ 
                   import sampleSuite.WidgetTest;

                  //import org.flexunit.listeners.UIListener;

       

                  import org.flexunit.runner.FlexUnitCore;
                   //import org.flexunit.listeners.CIListener;                       
                   private var core:FlexUnitCore;

       

                  private function onCreationComplete():void
                   {
                       //testRunner.runWithFlexUnit4Runner(currentRunTestSuite(), "deleteme");
                       core = new FlexUnitCore();              
                       core.run(WidgetTest);
                   }        

       

              ]]>
           </fx:Script>
           <fx:Declarations>


              <!-- Place non-visual elements (e.g., services, value objects) here -->
          </fx:Declarations>
         
      </s:Application>

       

      and my ant script looks like this

       

      <target name="test" depends="build-test">  <!--  -->
               <taskdef resource="flexUnitTasks.tasks" classpath="./flexunit/flexUnitTasks-4.0.0.jar"/>
               <flexunit swf="./bin/${tester}" verbose="true"  localTrusted="true" timeout="15000" headless="true" toDir="./ASCoverage"  haltonfailure="true"/>
      </target>

        • 1. Re: Running unit tests from ant: flashplayer window remains open
          acastrucc Level 1

          Oh I should mention this is my resulting output

           

          [flexunit] Generating default values ...
          [flexunit] Using default snapshot file path [.... \snapshot.jpg]
          [flexunit] Using the following settings:
          [flexunit]     haltonfailure: [true]
          [flexunit]     headless: [true]
          [flexunit]     localTrusted: [true]
          [flexunit]     player: [flash]
          [flexunit]     port: [1024]
          [flexunit]     snapshot: [false]
          [flexunit]     snapshotFile: [... snapshot.jpg]
          [flexunit]     swf: [... \bin\FlexUnitApplication.swf]
          [flexunit]     timeout: [15000ms]
          [flexunit]     toDir: [... \ASCoverage]
          [flexunit]     verbose: [true]
          [flexunit]     xcommand: [xvfb]
          [flexunit] Setting up server process ...
          [flexunit] OS: [Windows]
          [flexunit] Starting server ...
          [flexunit] Launching player:
          [flexunit] Executing 'rundll32' with arguments:
          [flexunit] 'url.dll,FileProtocolHandler'
          [flexunit] '... \FlexUnitApplication.swf'
          [flexunit] The ' characters around the executable and arguments are
          [flexunit] not part of the command.
          [flexunit] Opening server socket on port [1024].
          [flexunit] Waiting for client connection ...
          [flexunit] Created local trust file at [C:\WINDOWS\system32\Macromed\Flash\FlashPlayerTrust\flexUnit.cfg]
          [flexunit]
          [flexunit] Stopping server ...
          [flexunit] End of test data reached, sending acknowledgement to player ...
          [flexunit] Closing client connection ...
          [flexunit] Closing server on port [1024] ...

           

          BUILD FAILED

          ... \build.xml:19: java.util.concurrent.ExecutionException: Socket timeout waiting for flexunit report

          • 2. Re: Running unit tests from ant: flashplayer window remains open
            Simeon Bateman Level 2

            Hi There,

             

            The CIListener is actually responsible for closing that, but you don't appear to be adding that as a listener.

             

            Checkout the runner we use with our FlexUnit tests, you will see we add a CIListener.

             

            https://github.com/flexunit/flexunit/blob/master/FlexUnit4Test/src/TestRunner.mxml

             

            Let me know if that works out for you.

             

            Simeon Bateman

             

            Principal Instigator

            PNW Rain LLC

            simeon@pnwrain.com

            503-616-4405

            1 person found this helpful