Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Ant xml example(AIRAntJUnitTest) for FLEX/AS3 code j-unit test.
<?xml version="1.0"?>
<project name="AIRAntUnitTest" default="build">
<!-- TODO Change to your Flex SDK directory -->
<property name="flex.sdk.dir" value="C:\Software\FLEX\sdks\4.6.0" />
<property name="lib.dir" value="${basedir}/libs" />
<!-- ATTENTION: Since we remove the reports directory during the clean target it get's
deleted so DO NOT specifiy any directory which you do not want to be deleted!!! -->
<property name="output.loc" location="${basedir}/target" />
<property name="bin.loc" location="${output.loc}/unittest/bin" />
<property name="report.loc" location="${output.loc}/unittest/report" />
<property name="dist.loc" location="${output.loc}/unittest/dist" />
<property name="reports.dir" value="${output.loc}/unittest/report" />
<property name="APP_NAME" value="AIRAntUnitTest"/>
<property name="FLEX_HOME" value="${flex.sdk.dir}" />
<taskdef resource="flexTasks.tasks" classpath="${FLEX_HOME}/ant/lib/flexTasks.jar" />
<!-- Define ADL (AIR Debug Launcher) cross platform -->
<condition property="ADL" value="${FLEX_HOME}/bin/adl.exe">
<os family="windows"/>
<property name="ADL" location="${FLEX_HOME}/bin/adl" />
<property name="AIR_OUTPUT" value="bin-release"/>
<property name="APP_DESCRIPTOR" value="${AIR_OUTPUT}/${APP_NAME}-app.xml"/>
<target name="build" depends="clean, compile, run-tests, generate-reports" />
<target name="clean">
<delete dir="${AIR_OUTPUT}" />
<delete dir="${reports.dir}" />
<target name="compile">
<mxmlc file="${basedir}/src/${APP_NAME}.mxml"
<source-path path-element="${basedir}/src" />
<!-- Core Flex Libraries -->
<compiler.library-path dir="${FLEX_HOME}/frameworks" append="true">
<include name="libs" />
<compiler.library-path dir="${FLEX_HOME}/frameworks/locale" append="true">
<include name="en_US" />
<!-- Local Libraries (FlexUnit.swc) -->
<compiler.library-path dir="${basedir}" append="true">
<include name="libs" />
<include name="libs/junit" />
<target name="run-tests">
<delete dir="${reports.dir}" />
<mkdir dir="${reports.dir}"/>
<echo>Test descriptor ${APP_DESCRIPTOR} with ADL ${ADL} and content ${APP_NAME}.swf</echo>
<!-- If you have a FlexBuilder generated application descriptior you have
to replace the token below manually to set the right APPLICATION.swf -->
<copy file="${basedir}/src/${APP_NAME}-app.xml" todir="${basedir}/${AIR_OUTPUT}" overwrite="true" />
<replace file="${APP_DESCRIPTOR}"
token="[This value will be overwritten by Flex Builder in the output app.xml]"
value="${APP_NAME}.swf" />
<!-- Run the tests -->
<exec executable="${ADL}" failonerror="false">
<arg line="${APP_DESCRIPTOR}"/>
<arg line="-- '${reports.dir}'"/>
<target name="generate-reports">
<echo>Generate reports to ${reports.dir}</echo>
<junitreport todir="${reports.dir}">
<fileset dir="${reports.dir}">
<include name="*_TEST-*.xml"/>
<report format="frames" todir="${reports.dir}/html"/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.