3 Replies Latest reply on May 29, 2010 11:15 AM by mlabriola

    can i avoid needing to manually enumerate all TestCases in a TestRunner for an ant build?


      flexunit gurus,


      i've been experimenting with the FlexUnit4SampleCIProject as part of following the instructions for ant builds at http://docs.flexunit.org/index.php?title=Ant_Task


      this sample project utilizes a TestRunner.mxml file that manually enumerates every TestCase that should be run as part of the tests.  e.g. after i modified TestRunner.mxml to test my locally developed classes, a snippet looks like this:


                      var core : FlexUnitCore = new FlexUnitCore();

                      core.run(MathUtilTest, StringUtilTest);


      the ant build then invokes that TestRunner as part of the build:


              <!-- Execute TestRunner.swf as FlexUnit tests and publish reports -->
              <flexunit swf="${bin.loc}/TestRunner.swf"
                  localTrusted="true" />


      the associated maven build for this project does not require a TestRunner.mxml.  the following snippets from the configuration of the flexmojos plugin in the pom.xml allows for the TestCases to be run without needing to manually enumerate them ahead of time::




      Flash Builder 4 now supports a model like flexmojos - I can simply right click a project or folder and select Execute FlexUnit Tests and all the tests are run, without needing a TestRunner.mxml.  Flash Builder appears to accomplish this by dynamically generating (and then compiling and executing) 2 mxml files based on the FlexUnit tests found in the project/folder.  In Flex Builder 3 days, I had to manually maintain a TestRunner.mxml, which was error prone and cumbersome.


      my question is whether there is support in an ant build for running all *Test.as files without needing an associated TestRunner.mxml.  if so, could you post an example on how to accomplish this?  i suppose i could create a custom ant task that dynamically generates a mxml file after searching the file system for *Test.as files (similar to what Flash Builder 4 does), but since this seems like such a common need i'm hoping it is (or can be) provided as part of FlexUnit's ant tasks.