1 Reply Latest reply on Aug 26, 2009 6:55 AM by Roaders

    Running more than 1 flexunit task per ant build

    Roaders

      Hi

       

      I am setting our ant build up to run our unit tests. I have a macrodef that compiels and runs the tests:

       

      <macrodef name="runTests" >

      <attribute name="runner" />

      <attribute name="outputName" />

      <attribute name="sourceLocation" />

       

      <sequential>

      <mxmlc file="@{runner}" output="${REPORT.dir}/@{outputName}.swf">

      <source-path path-element="@{sourceLocation}" />

       

      <library-path dir="${LIBS.dir}" append="true">

      <include name="*.swc" />

      </library-path>

      <library-path dir="${DEPLOY_BIN.dir}" append="true">

      <include name="*.swc" />

      </library-path>

      </mxmlc>

       

      <!-- Execute TestRunner.swf as FlexUnit tests and publish reports -->

      <flexunit

      swf="${REPORT.dir}/@{outputName}.swf"

      toDir="${REPORT.dir}/xml"

      haltonfailure="false"

      verbose="true"

      localTrusted="true"

      />

      </sequential>

      </macrodef>

       

      and a task that calls this multiple times, builds the reports and then fails if any of the tests failed:

       

      <target name="compileTools">

      <antcall target="compileDevToolsModule"/>

      </target>

       

      <target name="runUnitTests" depends="compileLibs">

       

      <antcall target="compileCoreTest" />

       

      <runTests

      runner="${CORE_TESTS_PROJECT.dir}/src/CoreTests.mxml"

      outputName="core"

      sourceLocation="${CORE_TESTS_PROJECT.dir}/src"

      />

      <runTests

      runner="${LOGIN_PROJECT.dir}/src/LoginTests.mxml"

      outputName="login"

      sourceLocation="${LOGIN_PROJECT.dir}/test"

      />

       

      <antcall target="buildReports"/>

       

      <fail if="flexunit.failed" message="Unit Tests Failed. Check reports." />

      </target>

       

      Thsi all works fine if I am only running one test runner. If I am running 2 as in teh above example the second swf opens and all the tests run but it does not close. If I manually close it the ant build continues but no xml files are produced for the second runner.

       

      The reason I am running the tasks like this is because we have a lot of projects that each create a module. We can't have 1 test runner that runs all tests (unless we have test modules and load the tests into a main test runner ect but that's annoying).

       

      Is this scenario supported?