I searched for a long time but I still can not make it happen. I want
to do a function test on my application. The test Script is made by
Flex monkey. I was wondering, can I make it the same in Maven? I think
maybe Flex Mojos can make it. I am using Flex SDK 3.5, Flex Monkey 5
reloaded. Can Flex Mojos compile my desktop air, test it and generate
Junit test report?

The build.xml is below:

<?xml version="1.0" encoding="utf-8"?>
<project name="Calculatortest" default="build"  basedir=".">
        <property name="DEBUG" value="true"/>
        <property file="build.properties"/>
        <property name="FLEX_HOME" value="${flex.home}"/>
        <property name="MXMLC.JAR"  value="${FLEX_HOME}/lib/mxmlc.jar"/>
        <property name="AUTO_LIB_ROOT"  value="${FLEX_HOME}/frameworks/libs"/
>
        <property name="APP_NAME"  value="calculatortest"/>
        <property name="PROJECT_ROOT" value="${basedir}"/>
        <property name="SOURCE_ROOT"  value="${PROJECT_ROOT}/src"/>
        <property name="TEST_SRC_ROOT"  value="${PROJECT_ROOT}/src"/>
        <property name="CI_APP_DESCRIPTOR" value="${PROJECT_ROOT}/src/$
{APP_NAME}-app.xml"/>
        <property name="OUTPUT_ROOT"  value="${PROJECT_ROOT}/deploy"/>
        <property name="REPORT_ROOT" value="${PROJECT_ROOT}/report"/>
        <property name="LIB_ROOT"  value="${PROJECT_ROOT}/libs"/>
        <property name="SNAPSHOT_SRC_ROOT"  value="tests/snapshots"/>

        <!-- Location of the Monkey ant tasks -->
        <path id="libraries">
                <fileset dir="${basedir}/jars">
                        <include name="**/*.jar"/>
                </fileset>
        </path>

        <!-- FlexUnit ant task -->
        <taskdef resource="flexUnitTasks.tasks"
                         classpathref="libraries"/>

        <target name="build">
                <antcall target="clean"/>
                <antcall target="init"/>
                <antcall target="setup"/>
                <antcall target="compile"/>
                <antcall target="execute_tests"/>
        </target>

        <target name="clean">
                <delete dir="${OUTPUT_ROOT}"/>
                <delete dir="${REPORT_ROOT}"/>
        </target>

        <target name="init">
                <mkdir dir="${OUTPUT_ROOT}"/>
                <mkdir dir="${REPORT_ROOT}"/>
        </target>

        <target name="setup">
                <copy file="${CI_APP_DESCRIPTOR}"
                          todir="${OUTPUT_ROOT}"/>

                <copy todir="${OUTPUT_ROOT}/snapshots">
                        <fileset dir="${SNAPSHOT_SRC_ROOT}"/>
                </copy>
        </target>


        <!-- compile the application and tests -->
        <target name="compile">

                <java jar="${MXMLC.JAR}"
                                     fork="true"
                                    failonerror="true">
                                   <jvmarg value="-Xmx512m"/>
                        <!-- avoid running out of heap space during compile -->
                        <arg value="-debug=true"/>

                        <arg value="+flexlib=${FLEX_HOME}/frameworks"/>
                        <arg value="+configname=air"/>

                        <arg value="-source-path"/>
                        <arg value="${SOURCE_ROOT}"/>
                        <arg value="${TEST_SRC_ROOT}"/>

                        <arg 
value="-file-specs=${SOURCE_ROOT}/${APP_NAME}.mxml"/>

                        <arg value="-includes"/>
                        <arg value="FlexMonkeyTestController"/>

                        <arg value="-define+=FLEXMONKEY::antRun,true"/>
                        <arg 
value="-define+=FLEXMONKEY::snapshotDirectory,'file://$
{PROJECT_ROOT}/deploy/snapshots'"/>

                        <arg value="-include-libraries+=${LIB_ROOT}/
automation_monkey3.x.swc"/>
                        <arg 
value="-include-libraries+=${LIB_ROOT}/flexunit-4.1.0_RC2-28-
flex_3.5.0.12683.swc"/>
                        <arg value="-include-libraries+=${LIB_ROOT}/flexunit-
aircilistener-4.1.0_RC2-28-3.5.0.12683.swc"/>
                        <arg value="-include-libraries+=${LIB_ROOT}/flexunit-
cilistener-4.1.0_RC2-28-3.5.0.12683.swc"/>

                        <arg 
value="-include-libraries+=${AUTO_LIB_ROOT}/automation.swc"/>
                        <arg value="-include-libraries+=${AUTO_LIB_ROOT}/
automation_agent.swc"/>
                        <arg value="-include-libraries+=${AUTO_LIB_ROOT}/
automation_dmv.swc"/>
                        <arg value="-include-libraries+=${AUTO_LIB_ROOT}/
automation_flashflexkit.swc"/>

                        <arg value="-output=${OUTPUT_ROOT}/${APP_NAME}.swf"/>
                </java>
        </target>

        <!-- run the tests -->
        <target name="execute_tests">
                <flexunit player="air"
                precompiledAppDescriptor="${OUTPUT_ROOT}/${APP_NAME}-app.xml"
                toDir="${REPORT_ROOT}"
                 haltonfailure="false"
                verbose="true"/>

                <junitreport todir="${REPORT_ROOT}">
                <fileset dir="${REPORT_ROOT}">
                                <include name="TEST-*.xml"/>
                </fileset>
                <report format="frames"
                todir="${REPORT_ROOT}/html"/>
                </junitreport>
        </target>

</project>

-- 
You received this message because you are subscribed to the Google
Groups "Flex Mojos" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/flex-mojos

http://flexmojos.sonatype.org/

Reply via email to