10 Replies Latest reply on Jun 10, 2010 5:26 PM by legrosb

    FluxUnit 4 Task Fails on Server 2003 via Bamboo 2.6

    AlucinariOlim Level 1

      Hi there,

       

      I have a build file which includes tests, runs fine in my local dev environment via Flash Builder 4, and generates reports.  The test portion of the build fails however when executing on my CI server.  Some facts:

       

      -CI box = Windows Server 2003 VM with Atlassian's Bamboo as the agent.

      -flexUnit.cfg file exists and has the correct paths in it

      -I've set the mime type correctly (executing a swf file opens the projector-player)

      -I've copied over my flashplayer settings.sol to ensure security is set up the same

      -Bamboo is set to run as Local System

      -I have a CIListener and UIListener in my TestRunner.mxml file

      -Headless mode = false

      -The build log shows the following

       

      03-Jun-2010 13:48:59[flexunit] Opening server socket on port  [1024].
      03-Jun-2010 13:48:59[flexunit] Waiting for client connection ...
      03-Jun-2010 13:49:59[flexunit]
      03-Jun-2010 13:49:59[flexunit] Stopping server ...
      03-Jun-2010 13:49:59[flexunit] End of test data reached, sending  acknowledgement to player ...
      03-Jun-2010 13:49:59[flexunit] Closing client connection ...
      03-Jun-2010 13:49:59[flexunit] Closing server on port [1024] ...

       


      It appears that a connection can't be made to the player.  While I am remoted into the CI box, I can see a FlashPlayer process start up while the build is executing - nothing appears on the screen though. I noticed in a post someone mention that Server 2003 could run in  headless mode, however, when I have this set FlexUnitTasks throws an  error stating that headless mode isn't supported on windows.

       

      Remember, everything works perfectly while running on my local machine, with the same build file, folder locations, and so on...

       

      Any idea on what else I can try to made this work?

        • 1. Re: FluxUnit 4 Task Fails on Server 2003 via Bamboo 2.6
          mlabriola Level 4

          What happens if you just double click on the TestRunner.swf from the file system on the remote box? Does it launch? You mentioned you have the UIListener included so you should see the tests run after the CIListener times out.

           

          Let me know and I will continue to try to help,

          Mike

          • 2. Re: FluxUnit 4 Task Fails on Server 2003 via Bamboo 2.6
            AlucinariOlim Level 1

            The swf opens in Flash Projector and the app loads up - I imagine the tests start running but they don't change any visuals right now so I can't confirm based on that.

             

            I know that the swf gets compiled correctly though because the build file works just fine on my desktop.

            • 3. Re: FluxUnit 4 Task Fails on Server 2003 via Bamboo 2.6
              mlabriola Level 4

              The reason I ask is that you mention in your first post having a UIListener in your TestRunner. That should mean you would see visuals if all was working when this launched. Did I misunderstand this part earlier?

              • 4. Re: FluxUnit 4 Task Fails on Server 2003 via Bamboo 2.6
                AlucinariOlim Level 1

                The app that is being tested does have visual components, and those components do display after launching the TestRunner.swf file.

                 

                I was just saying that no tests that run change any of the visuals - so I wouldn't actually know if the tests are running after launching the TestRunner.swf file in the CI server.  You said I should see tests running after launching the swf - but I can't literally see them running... I'd just assume they were.

                • 5. Re: FluxUnit 4 Task Fails on Server 2003 via Bamboo 2.6
                  mlabriola Level 4

                  Going back to the original post, you say "-I have a CIListener and UIListener in my TestRunner.mxml file"

                   

                  The reason I am asking this is that the UIListener will literally show you the tests running. There is a progress bar and output that shows the tests running. So, I am trying to figure out if that was just a mistake when you originally mentioned this or, if the UIListener is there but you still don't see anything, then we have a bigger issue. I am just fishing for direction.

                   

                  Mike

                  • 6. Re: FluxUnit 4 Task Fails on Server 2003 via Bamboo 2.6
                    AlucinariOlim Level 1

                    Ok, I recant my previous statement about what executing the TestRunner.swf displays on the CI server.  On launch it shows the application loading bar so I figured it was just going strait into the app.  On expanding the window a bit I now see an error on the bottom of the window - Error #2032

                     

                    When I open the TestRunner.swf on my desktop the app loading bar completes and I'm left with a blank white screen.  On the CI server the app loading bar hangs and I have this error at the bottom of the app.

                     

                    Googling tells me that t is a stream error that occurs due to an unreachable HTTP or file request... I only use embedded assets and the main swf compiles and can be used just fine anyways.

                     

                    What goes on in the TestRunner.swf while the application is loading that would cause a stream error?  On a 2003 CI builder server only...

                     

                    It could be a firewall issue as it is a cloud-managed VM.  Would trying to create a CI Listener on a blocked port 1024 throw this error?

                    • 7. Re: FluxUnit 4 Task Fails on Server 2003 via Bamboo 2.6
                      mlabriola Level 4

                      I suppose it could, but I think you would see an error later in the process. Are you using our build scripts for all of this or is it something else?

                       

                      I am asking this question because, based on the error and when it is happening, it almost sounds as if it is trying to load a RSL which it cannot load. This is, of course, pure speculation, but any chance you are building it with the framework externalized as an RSL? This might work locally on your machine as builder would put RSLs where needed but would fail if they couldn't be found on the server... again, speculation but it seems strange to me.

                       

                      to answer your question about what happens in TestRunner.swf:

                       

                      On creationComplete it attempts to open an XML socket.

                       

                      By default it is opening to 127.0.0.1 on port 1024.

                      This can be configured differently by passing a different port and/or server into the constructor of the CIListener in the TestRunner file. It waits up to 2 seconds to a status back. If it connects the FlexUnit waits to hear some chatter on the XMLSocket to declare it a success, then it begins running tests.

                       

                      If it fails with an error one of two things can happen. If the error happened before there was ever a successful connect, FlexUnit simply removes the CIListener from the chain of people listening and proceeds.. so, for instance, if you had the UIListener also included, you would begin to see tests run on the screen.

                       

                      If it receives an error after a valid connect, it tries to close the player because bad things are happening.

                       

                      So, the reason I bring up the RSL thing above.. unless something really strange is happening.. even a security error trying to talk on port 1024 should just fail in the background and tests should begin to show up in the UIListener. That makes me feel like it is failing earlier than that... and hence my question about the RSLs.

                       

                      p.s. just to be sure we are on the same page, what I mean by the UIListener is making your TestRunner.mxml look like this:

                       

                      <mx:Script>

                        <![CDATA[

                          import compilationSuite.SuitesToRun;

                       

                          import org.flexunit.listeners.CIListener;

                          import org.flexunit.listeners.UIListener;

                          import org.flexunit.runner.FlexUnitCore;

                       

                       

                          private var core:FlexUnitCore;

                       

                          public function runMe():void {

                            core = new FlexUnitCore();

                            core.addListener( new CIListener());

                            core.addListener( uiListener );

                            core.run( compilationSuite.SuitesToRun );

                          }

                        ]]>

                      </mx:Script>

                      <adobe:TestRunnerBase id="uiListener" width="100%" height="100%"  />

                      This would tell the TestRunner to both send data to the CIServer and display it on the screen
                      Mike

                      • 8. Re: FluxUnit 4 Task Fails on Server 2003 via Bamboo 2.6
                        legrosb Level 3

                        @AlucinariOlim - Sorry for the delay in getting back to you.  This may be as simple as the Ant task writing the local trust file to the wrong location for WIndows 2003; trust issues are typically why we see the initial error you've posted.  By default the Ant task will attempt to write the file out to the user trust directory @ %APPDATA%\Macromedia\Flash Player\#Security\FlashPlayerTrust\.  If that does not exist then, it will then try the global trust directory @ %SYSTEMROOT%\system32\Macromed\Flash\FlashPlayerTrust\.  For Windows 2003, these locations may be different for the FP.  Please reply to us with the following and we'll get down to the root of the problem:

                         

                        - Values of the environment variables on your Win Server 2003: APPDATA and SYSTEMROOT

                        - Build script (or snippets) being used to compile and execute your TEST SWF

                        - Source code for your TestRunner.mxml

                        - Complete flexunit Ant task output when running your build script

                         

                        Please delete the flexunit.cfg file so we can see it being created in the output of the Ant task when executed.  Based on all this data and what you've provided us thus far we should have a pretty good picture as to where we can focus our attention for a fix.  I know there are others using Bamboo successfully with this Ant task, so we should be able to figure out something.

                         

                        Let me know what you can pull together.  Thanks.

                         

                        -Brian

                        • 9. Re: FluxUnit 4 Task Fails on Server 2003 via Bamboo 2.6
                          AlucinariOlim Level 1

                          I've finally managed to get tests working on my Server 2003 VM via Bamboo -

                           

                          The problem involved the RSL configuration data that comes default in the Flex SDK's flex-config.xml. Here is an example of what is in there by default:

                           

                              <runtime-shared-library-path>
                                  <path-element>libs/textLayout.swc</path-element>
                                  <rsl-url>textLayout_1.1.0.604.swf</rsl-url>
                                  <policy-file-url></policy-file-url>
                                  <rsl-url>http://fpdownload.adobe.com/pub/swz/flex/4.1.0.16032/textLayout_1.1.0.604.swf</rsl-url>
                                  <policy-file-url>http://fpdownload.adobe.com/pub/swz/crossdomain.xml</policy-file-url>
                              </runtime-shared-library-path>

                           

                          I had previously created a custom flex-config.xml and one of the changes involved commenting out the RSL data.  I did this because I noticed my browser was trying to establish external connections whenever I was running the app on my local machine.

                           

                          -My Flash Builder project pointed at this modified file

                          -My build file's mxmlc task pointed the file

                          -The flexunit task was not however using this file (it by default points to the file's default location within the FLEX_HOME directory)

                           

                          The script was executing correctly on my local machine, which means that a security setting/restriction on the Server 2003 VM was likely preventing Flash Projector from attempting to load the external RSLs defined in the default flex-config.xml file - which flexunit points to by default.

                           

                          The parameter I added to the mxmlc task to point to the non-default build file was:

                           

                          <load-config filename="${config.loc}/flex-config.xml"/>

                           

                          Will the flexunit task accept a similar configuration parameter? If so, what is the syntax? If not, it would be nice to be able to point to a non-default flex-config.xml file so as to avoid replacing the one that comes with the SDK everytime it is updated.

                           

                          I don't feel like spending time tracking down how or why the server couldn't hit these default RSL sites (let alone a fix) - so I'll live with this solution for now.

                           

                          Thanks for all the help guys.

                          • 10. Re: FluxUnit 4 Task Fails on Server 2003 via Bamboo 2.6
                            legrosb Level 3

                            @AlucinariOlim - Keep in mind unless you're using the new Ant task extensions for easier compilation in 4.1, your build is actually compiling the test SWF and determining the flex-config.xml to use for that compilation, not the FlexUnit Ant task.  The Ant task simply executes the test SWF using the config found in the SWF from compilation.  The steps you took are the typical steps to use a custom flex-config when building your test SWF.  I'm hesitant to rexpose the config for the mxmlc task to the new features in 4.1 since it's meant to make things simple.  If you need to compile something specific for your own scenario, compiling your own test SWF will probably still be the recommended course of action.  With 4.1, the FlexUnit4SampleCIProject will have examples on how to handle each scenario.

                             

                            Glad you were able to find a good solution.

                             

                            -Brian