I am trying to run FlexUnit tests through Ant in a very simplified version of the sampleCLIProject. The tests pass when I compile through Flash Builder and timeout when I run them through Ant on Windows. This timeout problem only occurs in the case of async tests. When I run them through Ant on Mac OS X, Ant is unable to receive data back from Flash Player.
Here's the main application that runs the tests:
TestRunner.mxml
<?xml version="1.0" encoding="utf-8"?><mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:flexUnitUIRunner="http://www.adobe.com/2009/flexUnitUIRunner" layout="absolute" creationComplete="runTests();"><mx:Script> <![CDATA[ import org.flexunit.demo.EchoPanelTest; import org.flexunit.listeners.CIListener; import org.flexunit.listeners.UIListener; import org.flexunit.runner.FlexUnitCore; public function runTests() : void{ var core : FlexUnitCore = new FlexUnitCore(); core.addListener(new UIListener(uiListener)); core.addListener(new CIListener()); core.run(EchoPanelTest); } ]]></mx:Script><flexUnitUIRunner:TestRunnerBase id="uiListener" width="100%" height="100%"/></mx:Application>
Here's the Ant build file:
build.xml
<?xml version="1.0" encoding="UTF-8"?><project name="Main Build File" default="run"><property file="build.properties" /><taskdef resource="flexTasks.tasks" classpath="${TASK_DIR}/flexTasks.jar" /><taskdef resource="flexUnitTasks.tasks"> <classpath> <fileset dir="/Users/ohassan/Downloads/flexunit 2"> <include name="flexUnitTasks*.jar" /> </fileset> </classpath></taskdef><target name="compile"> <mxmlc file="${SRC_DIR}/TestRunner.mxml" output="${BIN_DIR}/Main.swf"> <library-path dir="${LIB_DIR}" append="true"> <include name="*.swc" /> </library-path> <compiler.verbose-stacktraces>true</compiler.verbose-stacktraces> <compiler.headless-server>true</compiler.headless-server> </mxmlc></target><target name="run" depends="compile"> <flexunit swf="${BIN_DIR}/Main.swf" timeout="5000" toDir="${basedir}/reports" haltonfailure="false" verbose="true" localTrusted="false" command="${FLASH_PLAYER}" /></target></project>