5 Replies Latest reply on Oct 11, 2009 5:59 PM by mlabriola

    Running FlexUnit4 tests via ant & Hudson?

    timoxley Level 1

      I'm just starting to move towards test driven development and I'm trying to figure out how to get continuous integration with FlexUnit4 working for our Flex projects & Hudson.

       

      I've got our project compiling in Hudson via ant but I'm not sure how to go about having ant/Hudson run the FlexUnit4 tests? Is there an ant task I'm supposed to use or something somewhere?

       

      Is there any documentation I should be reading? Forum/blog posts? I see a bunch of stuff about opening sockets and whatnot but I'm not sure if that's how it's supposed to work.

       

      Thanks for any pointers.

        • 1. Re: Running FlexUnit4 tests via ant & Hudson?
          legrosb Level 3

          @timoxley - I'd suggest starting with a download of the Beta 2 turnkey download for FlexUnit4 (http://opensource.adobe.com/wiki/display/flexunit/Downloads).  Inside of the zip is a sample CI project which shows how to use Ant and Maven (via FlexMojos) to build and test your applications along with a README.txt file which will outline the capabilities of the Ant task at the time of the beta 2 release.  The Ant task has been significantly updated recently, so I'd strongly suggest building the Ant task from source to get the latest version or grabbing the latest build off our Hudson server ( http://flexunit.digitalprimates.net ).  We're still tuning our CI process as well so use the daily builds at your own risk, but the zips should contain everything you need.

           

          If you have any feedback or issues getting setup, just let us know.

           

          -Brian

          1 person found this helpful
          • 2. Re: Running FlexUnit4 tests via ant & Hudson?
            JoeNMDA Level 1

            Hi Brian,

             

            I downloaded the latest build and tried running the ant task in the CISample project on my dev box just to see if I could get it to work locally first. I got a big stack trace running this with flex 3.3 but it apeared to work better with flex 3.4. However the build failed running the "test" ant task. This was my output:

             

            init:

             

            compile:
                [mxmlc] Loading configuration file /opt/flex_sdk/3.4.0/frameworks/flex-config.xml
                [mxmlc] /home/jersinghaus/fu4/4.x/FlexUnit4SampleCIProject/bin/Main.swf (327000 bytes)

             

            test:
                [mxmlc] Loading configuration file /opt/flex_sdk/3.4.0/frameworks/flex-config.xml
                [mxmlc] /home/jersinghaus/fu4/4.x/FlexUnit4SampleCIProject/bin/TestRunner.swf (846287 bytes)
            [flexunit] Creating local trusted file
            [flexunit] opened server socket

             

            BUILD FAILED
            Error launching the test runner.

             

            So I thought I'd ask a few questions:

             

            1. Is there a log file somewhere that might give me some more detail as to the error?

            2. I'm familiar with fluint's test runner which is an air application which runs test suites inside modules compiled to swf's. (I'm sure you know all this ) But here it looks like you call flex with no air related calls.  Does CISample project and associated ant build script work for air applications?

             

             

            Thanks,

            Joe

            • 3. Re: Running FlexUnit4 tests via ant & Hudson?
              legrosb Level 3

              @JoeNMDA - Looks like the stand-alone Flash Player failed to open during the build run.  The way the Ant task runs your test SWF is a legacy artifact from the FU1 task, I believe.  For Mac and Windows it uses the associated application for the SWF extension to open the standalone Flash Player and on Linux it assumes that you have an executable named gflashplayer defined somewhere on the user's path.  Based on your platform, try to associate the standalone debug flashplayer with the SWF file extension and the player should launch; I think the mime type for a SWF is application/x-shockwave-flash.

               

              With regards to your questions, currently the Ant tasks only outputs to the console and we don't (as of yet) have a way to test suites dependent on the AIR libraries.  That being said, it's on the roadmap, and I was approached today about getting it working soon, so I may have something in the immediate future, but no promises.  For what its' worth, I'd suggest grabbing a daily build off of our CI server ( http://flexunit.digitalprimates.net ) if you want to experiment with the latest incarnation of the Ant task.  It's been refactored quite a bit and I've dramatically improved the "verbosity" of the console messages for easier debugging.

               

              Hope this helps.

               

              -Brian

              • 4. Re: Running FlexUnit4 tests via ant & Hudson?
                timoxley Level 1

                Thanks for the info Brian.

                 

                For other's reference:

                 

                The FlexUnit4TurnkeyBeta_2.0.zip from the Adobe site doesn't contain the README.txt, or anything regarding CI, Maven or Ant. Just a test project and some libs. Instead, you can download these files from the Project_FlexUnit4-Flex4 workspace in Brian's hudson (or did I miss something?).

                 

                I'm checking it all out now, but as all of these tools are fairly new to me, I'm certainly in over my head at this point.

                 

                I'm using the Flex 4 Beta 2 release, is this going to be a problem, as the projects/files suggest most of the stuff is set up for Flex3.x/Flex4 Beta 1?

                 

                For anyone who is interested, I posted a similar question regarding Running FlexUnit4 tests via ant & Hudson on stackoverflow.

                • 5. Re: Running FlexUnit4 tests via ant & Hudson?
                  mlabriola Level 4

                  Tim,

                   

                  A few tidbits, first, flash builder beta 2 is not a problem. We have been testing on these bits for sometime now and all works well.

                   

                  Second, the turnkey project is intended just to be a quick start for people wanting to get a sense of how to use the project. You can always find the full source for any of the projects associated with FlexUnit 4 in SVN @ http://opensource.adobe.com/svn/opensource/flexunit/branches/4.x/

                   

                  Lastly, the flexunit.digitalprimates.net server will continue to contain built assets for those who would rather get binaries than source directly. This will continue to evolve as timne goes on and, hopefully, someday, this will be a hub for all things flexunit related.

                   

                  Mike

                  1 person found this helpful