6 Replies Latest reply on Jul 7, 2010 5:07 AM by mlabriola

    org.flexunit.listeners.UIListener not found, and other problems


      I have a basic setup of FlexUnit that comes with the latest FlashBulider. I import a bunch of SWC's in my project and try to follow instructions from here:




      I got an error saying defintion of UIListener could not be found.


      Then I checked the AS docs here: http://docs.flexunit.org/asdocs/index.html


      And found out there is no UIListener class at all


      So I realized that core.addListener takes IRunListener, and change the code to this:




      Sadly, when run. there was a runtime error with this line:


      <flexui:TestRunnerBase id="uiListener" width="100%" height="100%" x="0" y="0" />


      Saying TestRunnerBase does not implement the IRunListener intarface,

        • 1. Re: org.flexunit.listeners.UIListener not found, and other problems
          mlabriola Level 4

          The UIListener is not in the core project, it is in the UIListener project, so unless you have that one as well, you will not have the UIListener.


          My guess though is that it is a TestRunnerBase issue. TestRunnerBase isn't something we wrote for FlexUnit 4. It is an adaption of a FlexUnit 1 concept to give people a familiar environment as a default test runner. The goal is to eventually write a new one for FlexUnit 4 but our priorities were features and IDE integration.


          All of that said, I am guessing the flexui namespace in your project is pointing to an older version of the TestRunnerBase buried somewhere in the FlexUnit .9 project. We include FlexUnit .9 in its entirety for compatibility reasons, but it means that you can sometimes reference older classes. The appropriate namespace should be:




          If that doesn't work, then you are missing the FlexUnit4UIListener.swc and your namespace is probably set differently. Here is another thread on this same issue:




          When configured correctly, your MXML file should read something like this:


          <?xml version="1.0" encoding="utf-8"?>



          creationComplete="runMe()" xmlns:adobe="http://www.adobe.com/2009/flexUnitUIRunner">




                  import org.flexunit.listeners.UIListener;

                  import compilationSuite.SuitesToRun;


                  import org.flexunit.runner.FlexUnitCore;



                  private var core:FlexUnitCore;



                  public function runMe():void {

                    core = new FlexUnitCore();

                    core.addListener( uiListener );

                    core.run( compilationSuite.SuitesToRun );




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


          I will give the wiki page you reference a read today and see if I can make things clearer,



          • 2. Re: org.flexunit.listeners.UIListener not found, and other problems
            mraak Level 1

            I'm trying to follow your example but get this error now:



            Description    Resource    Path    Location    Type
            Could not resolve <adobe:TestRunnerBase> to a component implementation.    FlexUnitTestTest.mxml    /FlexUnitTestTest/src    line 44    Flex Problem



            I guess I'm not using the right SWC's. Which should I be using out of those that come with FB4 and are located in my Program Files?

            • 3. Re: org.flexunit.listeners.UIListener not found, and other problems
              mraak Level 1

              I see the swc's used in turnkey projects could not be found in Program Files... Adobe ... Flash Builder ... plugins. Isn't FU4 supposed to be integrated with FB? Am I supposed to get swc's from elsewhere?

              • 4. Re: org.flexunit.listeners.UIListener not found, and other problems
                mlabriola Level 4

                This doesn't have anything to do with program files or installed programs, we are just discussing the SWC library files which are used by FlexUnit.


                Regarding Flash Builder integration: If you have Flash Builder 4 Premium, then none of this applies to you and things are much easier. If you are using premium, right click on your project, choose New Test Case Class. The wizards will setup everything required for unit testing with FlexUnit and you needn't worry about UIListeners, etc.


                The UIListener and everything else is for providing visual feedback when you are not using an IDE such as Flash Builder Premium, FDT or Intellij.


                Let me know what version of Flash Builder you are using and I can help more.



                • 5. Re: org.flexunit.listeners.UIListener not found, and other problems
                  mraak Level 1

                  I do indeed have FB Premium and the ability to right click and create Test Case Class. I can also run these tests in the special Eclipse panel. However, I need a visual representation of the tests that will run in an automated manner on the build server. Hence, I need the visual runner and UIListener.


                  I just grabbed swc's from the turnkey project and pasted them in my libs folder and it worked nicelly. These are I believe meant only for visual runner?


                  It's a bit unclear how to use and update all the necessary swc's regularly.

                  • 6. Re: org.flexunit.listeners.UIListener not found, and other problems
                    mlabriola Level 4

                    go to flexunit.org. there is a downloads tab which will always contain the last release build along with the latest betas for next versions. choose to download the zip file with the full libraries. the turnkey project is really just a quick demo package.


                    this libraries zip will have everything we publish. you can also grab nightly builds from our build server at builds.flexunit.org or simply poke around to see how we manage automated builds.