Hi
I am having trouble while trying to run flexunit tests through ant script I have searched all over the internet but cannot find anything helpful. For my project I am using Flash builder 4.6 and flex sdk 4.6.
Ant version being used is 1.8.4
I am getting error when i run the ant script. below is a complete trace.
Buildfile: C:\cygwin\home\Admin\mca\apps\nac\build.xml
build:
clean:
[delete] Deleting directory C:\cygwin\home\Admin\mca\apps\nac\release
init:
[mkdir] Created dir: C:\cygwin\home\Admin\mca\apps\nac\build
[copy] Copying 2 files to C:\cygwin\home\Admin\mca\apps\nac\build
[mkdir] Created dir: C:\cygwin\home\Admin\mca\apps\nac\release
compile:
[mxmlc] Loading configuration file C:\Program Files\Adobe\Adobe Flash Builder 4.6\sdks\4.6.0\frameworks\air-config.xml
[mxmlc] C:\cygwin\home\Admin\mca\apps\nac\build\Nimbutas.swf (850356 bytes)
package:
cleanup:
[delete] Deleting directory C:\cygwin\home\Admin\mca\apps\nac\build
test:
cleanFlexUnitReport:
[echo] Deleting FlexUnit Report Directory...
[delete] Deleting directory C:\cygwin\home\Admin\mca\apps\nac\flexunitreports
[echo] Deleted FlexUnit Report Directory
[echo] Creating FlexUnit Report Directory...
[mkdir] Created dir: C:\cygwin\home\Admin\mca\apps\nac\flexunitreports
[echo] Created FlexUnit Report Directory
cleanTest:
[echo] Deleting Test Directory...
[delete] Deleting directory C:\cygwin\home\Admin\mca\apps\nac\flexunittest
[echo] Deleted Test Directory
[echo] Creating Test Directory...
[mkdir] Created dir: C:\cygwin\home\Admin\mca\apps\nac\flexunittest
[echo] Created Test Directory
compileTestRunner:
[echo] Compiling Test Runner SWF To Test
[mxmlc] Loading configuration file C:\Program Files\Adobe\Adobe Flash Builder 4.6\sdks\4.6.0\frameworks\flex-config.xml
[mxmlc] Warning: Source path entry, 'C:\cygwin\home\Admin\mca\apps\nac\src\flexUnitTests\com\nimbutas', is a subdirectory of source path entry, 'C:\cygwin\home\Admin\mca\apps\nac\src'.
[mxmlc] Required RSLs:
[mxmlc] http://fpdownload.adobe.com/pub/swz/flex/4.6.0.23201/framework_4.6.0.23201.swz with 1 failover.
[mxmlc] http://fpdownload.adobe.com/pub/swz/tlf/2.0.0.232/textLayout_2.0.0.232.swz with 1 failover.
[mxmlc] http://fpdownload.adobe.com/pub/swz/flex/4.6.0.23201/spark_4.6.0.23201.swz with 1 failover.
[mxmlc] http://fpdownload.adobe.com/pub/swz/flex/4.6.0.23201/sparkskins_4.6.0.23201.swz with 1 failover.
[mxmlc] http://fpdownload.adobe.com/pub/swz/flex/4.6.0.23201/mx_4.6.0.23201.swz with 1 failover.
[mxmlc] C:\cygwin\home\Admin\mca\apps\nac\flexunittest\FlexUnitApplication.swf (352174 bytes)
[echo] Compiled Test Runner SWF To Test
executeTestRunner:
[echo] Running Test Runner SWF
[flexunit] Validating task attributes ...
BUILD FAILED
C:\cygwin\home\Admin\mca\apps\nac\build.xml:24: The following error occurred while executing this line:
C:\cygwin\home\Admin\mca\apps\nac\build.xml:31: The following error occurred while executing this line:
C:\cygwin\home\Admin\mca\apps\nac\build.xml:151: java.lang.NullPointerException
And here is my build.xml file
<?xml version="1.0" encoding="UTF-8"?>
<project name="Build File" basedir="." default="build">
<!--location of property file -->
<property file="${basedir}/build.properties" description="your specific properities for builds" />
<!-- additional tasks -->
<taskdef name="mxmlc" classname="flex.ant.MxmlcTask" classpath="${FLEX_TASKS}"/>
<taskdef name="compc" classname="flex.ant.CompcTask" classpath="${FLEX_TASKS}"/>
<taskdef name="asdoc" classname="flex.ant.AsDocTask" classpath="${FLEX_TASKS}"/>
<taskdef resource="flexUnitTasks.tasks" classpath="${FlexUnitTasks.file}"/>
<!--
Build
-->
<target name="build" description="compiles application">
<antcall target="init"/>
<antcall target="package"/>
<antcall target="cleanup"/>
<antcall target="test"/>
</target>
<target name="test" description="compiles unit tests">
<antcall target="cleanFlexUnitReport"/>
<antcall target="cleanTest"/>
<antcall target="compileTestRunner"/>
<antcall target="executeTestRunner"/>
</target>
<target name="compile"
description="Compiles the AIR application to a SWF file and places SWF in a temp directory to be packaged.">
<mxmlc file="${SOURCE_DIR}/${APP_NAME}.${APP_EXTENSION}"
output="${BUILD_DIR}/${APP_NAME}.swf"
locale="${LOCALE}"
static-rsls="true"
accessible="true"
configname="air"
debug="${DEBUG_FLAG}"
failonerror="true"
fork="true">
<source-path path-element="${SOURCE_DIR}"/>
<source-path path-element="${basedir}/resources"/>
<external-library-path file="${APP_HOME}/libs/airglobal.swc" append="true"/>
<library-path dir="${LIBRARY_DIR}" includes="*.swc" append="true"/>
</mxmlc>
</target>
<target name="certificate" unless="CERTIFICATE_FLAG">
<java jar="${ADT}" fork="true"
failonerror="true">
<arg value="-certificate"/>
<arg value="-cn"/>
<arg value="${CERT_NAME}"/>
<arg value="-ou"/>
<arg value="${CERT_ORG_UNIT}"/>
<arg value="-o"/>
<arg value="${CERT_ORG_NAME}"/>
<arg value="-c"/>
<arg value="${CERT_COUNTRY}"/>
<arg value="${CERT_KEY_TYPE}"/>
<arg value="${KEYSTORE}"/>
<arg value="${CERT_PASSWORD}"/>
</java>
</target>
<target name="package" depends="compile"
description="Packages the build SWF file from a temp directory.">
<java jar="${ADT}" fork="true"
failonerror="true">
<arg value="-package"/>
<arg value="-tsa" />
<arg value="http://ca.signfiles.com/TSAServer.aspx" />
<arg value="-storetype"/>
<arg value="${STORETYPE}"/>
<arg value="-keystore"/>
<arg value="${KEYSTORE}"/>
<arg value="-storepass"/>
<arg value="${CERT_PASSWORD}"/>
<arg value="${RELEASE_DIR}/${APP_NAME}.air"/>
<arg value="${SOURCE_DIR}/${APP_NAME}-app.xml"/>
<arg value="-C"/>
<arg value="${BUILD_DIR}"/>
<arg value="${BUILD_DIR}/${APP_NAME}.swf"/>
<arg value="${BUILD_DIR}/Doorbell-old-tring.mp3"/>
<arg value="${BUILD_DIR}/US_ringback_tone.mp3"/>
</java>
</target>
<target name="init" depends="clean"
description="Cleans the deploy file">
<mkdir dir="${BUILD_DIR}"/>
<copy todir="${BUILD_DIR}">
<fileset dir="${basedir}/resources"/>
</copy>
<mkdir dir="${RELEASE_DIR}"/>
<available file="${KEYSTORE}" property="CERTIFICATE_FLAG"/>
</target>
<!-- start of flex unit tests -->
<target name="cleanFlexUnitReport" description="Cleans the Report file">
<echo>Deleting FlexUnit Report Directory...</echo>
<delete dir="${FlexUnitReport.dir}" failOnError="false"
includeEmptyDirs="true" />
<echo>Deleted FlexUnit Report Directory</echo>
<echo>Creating FlexUnit Report Directory...</echo>
<mkdir dir="${FlexUnitReport.dir}" />
<echo>Created FlexUnit Report Directory</echo>
</target>
<target name="cleanTest" description="Cleans the Test file">
<echo>Deleting Test Directory...</echo>
<delete dir="${Test.dir}" failOnError="false"
includeEmptyDirs="true" />
<echo>Deleted Test Directory</echo>
<echo>Creating Test Directory...</echo>
<mkdir dir="${Test.dir}" />
<echo>Created Test Directory</echo>
</target>
<target name="compileTestRunner">
<echo>Compiling Test Runner SWF To Test</echo>
<mxmlc file="${TestRunnerSrc.dir}/${TestRunner.name}.mxml"
output="${Test.dir}/${TestRunner.name}.swf"
debug="true">
<load-config filename="${FLEX_HOME}/frameworks/flex-config.xml"/>
<compiler.source-path path-element="${SOURCE_DIR}/flexUnitTests/com/nimbutas" />
<compiler.library-path dir="${TestRunnerLib.dir}" append="true">
<include name="*.swc"/>
</compiler.library-path>
<compiler.verbose-stacktraces>true</compiler.verbose-stacktraces>
<compiler.headless-server>true</compiler.headless-server>
</mxmlc>
<echo>Compiled Test Runner SWF To Test</echo>
</target>
<target name="executeTestRunner" description="executes the test runner app">
<echo>Running Test Runner SWF</echo>
<flexunit
toDir="${FlexUnitReport.dir}"
haltonfailure="true"
verbose="true"
player="air"
headless="false"/>
<echo>Ran Test Runner SWF</echo>
<echo>Generate Readable Tests</echo>
<junitreport todir="${FlexUnitReport.dir}">
<fileset dir="${FlexUnitReport.dir}">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="${FlexUnitReport.dir}/html"/>
</junitreport>
<echo>Generated Readable Tests</echo>
</target>
<!-- end of flex unit tests -->
<target name="clean"
description="Cleans up old files.">
<delete dir="${BUILD_DIR}" failOnError="false" includeEmptyDirs="true" />
<delete dir="${RELEASE_DIR}" failOnError="false" includeEmptyDirs="true" />
</target>
<target name="cleanup"
description="Cleans up old files.">
<delete dir="${BUILD_DIR}" failOnError="false" includeEmptyDirs="true" />
</target>
</project>