Created
January 21, 2014 03:27
-
-
Save yangboz/8534005 to your computer and use it in GitHub Desktop.
Ant xml example(AIRAntJUnitTest) for FLEX/AS3 code j-unit test.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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"/> | |
</condition> | |
<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> | |
<target name="compile"> | |
<mxmlc file="${basedir}/src/${APP_NAME}.mxml" | |
locale="en_US" | |
debug="true" | |
configname="air" | |
output="${AIR_OUTPUT}/${APP_NAME}.swf" | |
actionscript-file-encoding="UTF-8"> | |
<source-path path-element="${basedir}/src" /> | |
<!-- Core Flex Libraries --> | |
<compiler.library-path dir="${FLEX_HOME}/frameworks" append="true"> | |
<include name="libs" /> | |
</compiler.library-path> | |
<compiler.library-path dir="${FLEX_HOME}/frameworks/locale" append="true"> | |
<include name="en_US" /> | |
</compiler.library-path> | |
<!-- Local Libraries (FlexUnit.swc) --> | |
<compiler.library-path dir="${basedir}" append="true"> | |
<include name="libs" /> | |
<include name="libs/junit" /> | |
</compiler.library-path> | |
</mxmlc> | |
</target> | |
<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}'"/> | |
</exec> | |
</target> | |
<target name="generate-reports"> | |
<echo>Generate reports to ${reports.dir}</echo> | |
<junitreport todir="${reports.dir}"> | |
<fileset dir="${reports.dir}"> | |
<include name="*_TEST-*.xml"/> | |
</fileset> | |
<report format="frames" todir="${reports.dir}/html"/> | |
</junitreport> | |
</target> | |
</project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment