4 Replies Latest reply on Nov 3, 2009 10:43 AM by RussSchmidt

    How to test with the standard Flash player, rather than debug player

    trevorbutler Level 1



      I am interested in running my flexunit 4 tests against the standard flash player, rather than the debug player that comes with the SDK.  Is this possible?


      BTW, I am working on Windows for now.


      I installed both the flash ActiveX control for IE, and the standard flash plugin for Firefox.  I then associated the SWF file extension with Firefox using the "Open With" dialog.  I had to choose a single program, and the browser appeared to be my only choice, as I could not find any sort of "FlashPlayer10.exe" to associate with.  I ran my ant script that calls <flexunit>, and it kind of works.  It launches Firefox, runs the tests, and the results get piped back, but Firefox is not shut down.  Yep, Firefox stays open after the tests complete.  I seem to recall that the debug flash player would close itself after being opened by <flexunit>.  I tried using IE, and the same result occurs: the browser is not shutdown after the tests complete.  This behavior makes for an unacceptable test setup, as eventually the system memory on the machine will be exhausted as more and more browsers are opened and not closed.



      1) Is there a standard flash player "executable" somewhere on my system that I can associate the SWF files with (that would hopefully shut itself down)?

      2) Second choice, is there a way to get the browser to close after <flexunit> completes?
      3) or am I stuck using the debug player?  I am concerned that testing management at my company might not like the fact that we are testing against a debug player, rather than the standard one that users will likely be using. If flexunit 4 CI only supports the debug player, is there something I can say to appease management?


      Thanks for any help...


        • 1. Re: How to test with the standard Flash player, rather than debug player
          legrosb Level 3

          @trevorbutler - Here are my 2 cents, but the group may have a different perspectives for your questions.


          Currently, we suggest the use of the CIListener class as a FU4 listener for use when building your test SWF to run via the FU4 Ant task.  This class (http://opensource.adobe.com/svn/opensource/flexunit/branches/4.x/FlexUnit4CIListener/src/o rg/flexunit/listeners/CIListener.as) uses the fscommand() function to send a message to its host environment to exit (i.e. - fscommand("quit")).  This command is only recognized by the Flash projector and stand-alone players, which are thin wrappers around the Flash Player so that it may be executed as its own process in the OS.  Based on the setup you are describing, the behavior you're seeing should be expected since the browser is the host environment for the Flash Player.  When the browser recieves the resulting message of the fscommand("quit") call nothing will happen since the browser doesn't support this command.  If you use the Flash projector or stand-alone players however, they will exit when recieving the results of this command.  The projector/stand-alone players come in two flavors, release and debug.  Release will act very closely to the typical plugin installed in the web browser (e.g. - swallows errors, no debug support, etc) whereas debug will allow you to write log files to the system, show error messages, etc.  Currently the debug stand-alones are available on Windows, Mac, Linux and the release stand-alone is only available on Linux.


          To address your questions:


          1.  If you've installed the Flash Player browser plugin, there is no way that I know of to launch the player as its own process.  I've only had success using the projector/stand-alone player (http://www.adobe.com/support/flashplayer/downloads.html).


          2.  The Flash Player does have the ability to send javascript to the browser to ask it to close the current window, but most modern browser will prompt the user to confirm they'd like to close the window if its the only open window.  Additionally, taking this approach on Mac, the browser process would remain active until an explicit call is made to the host OS to shut down the browser process.  The Ant task could be enhanced to use the browser to launch the Flash Player, but that is not currently on our checklist of features to support.  If it's something you'd be interested in contributing, let me know and I can work with you on this.


          3.  For the time being the FlexUnit4 Ant task only supports the stand-alone Flash Player (and adl soon), which for Windows only comes in the debug flavor. The only thing I've run into with the stand-alone player is that ExternalInterface reports that its enabled, but since the host environment is not the browser, javascript calls made via this class will fail, consequently causing tests to fail.  I haven't tried anything with shared objects or flashvars but my assumption is that they should work correctly, but anything that depends on the browser has the potential not to.


          As far as your testing management goes, I would discuss with them the problem context FlexUnit4 hopes to solve.  The framework is intended to produce unit and integration tests.  Functional testing is not withing the scope of the library.  Although, it's technically feasible to write integration tests which will exercise components similarly to a functional test, tools such as FlexMonkey, Selenium Flex, QTP, etc are much better geared towards this problem domain.  Test recording and playback, using these tools, is typically done using the FP browser plugin and is much easier to use by most QA and testing staff.  At the end of the day, as we're testing our code using FlexUnit at a smaller granularity than that of which the user interacts with in our application.  To reliably test the applicaiton as the user would interact with it requires additional tooling and a different type of testing.


          Like I said, just my take, maybe some of the other guys can help as well.

          • 2. Re: How to test with the standard Flash player, rather than debug player
            mlabriola Level 4

            A few things. I am pretty sure there is a release standalone player for windows. You can get it here:




            It is part of the bundle of players.


            Second, since we know when we are done receiving results from the test run via the CIListener, we could just kill the browser process at that point, that would solve the issue for anyone wanting to run in the web browser environment, which is a legitimate concern.



            • 3. Re: How to test with the standard Flash player, rather than debug player
              trevorbutler Level 1

              Thanks, Brian and Mike,


              There are other test groups here that perform click/record type FlexMonkey testing in the browser, so browser testing is being covered.  So, for us, I do not think running flexunit in the browser (and closing the browser) is a requirement, especially if there is a standard stand-alone player available. I will try to locate the standalone player for windows and see how that goes.  Thanks for your help.



              • 4. Re: How to test with the standard Flash player, rather than debug player



                I'm also interested in doing testing in a CI environment that'll be using the browser player plugin not the standalone player.  Any timeframe for killing off the browser process as mentioned in your reply above?