21 Replies Latest reply on Dec 13, 2009 8:56 AM by mlabriola

    FlexUnit + AIR + Ant?

    barg27 Level 1

      Is the ant <flexunit> task compatible with AIR?

       

      My AIR app uses a SQLite database and some of my integration tests will create a sample database and needs to use the File object in the AIR SDK.  I can compile fine by including the AIR libraries, but when I run the tests in the TestRunner, I get a bunch of AIR related error messages and I get a socket timeout while waiting for the reports message.  These could be separate issues, but I want to make sure what I'm doing is possible with this tool.

       

      Here's a sampling of my ant targets if it helps...

       

          <target name="compile.tests">
              <echo>Compiling Jars Test Cases</echo>
             
              <mkdir dir="${reports.dir}/tests" />
         
              <mxmlc
                  file="${test.src}/${test.app.name}.mxml"
                  output="${test.bin}/${test.app.name}.swf"
                  actionscript-file-encoding="UTF-8"
                  keep-generated-actionscript="false"
                  incremental="false"
                  locale="en_US"
                  use-network="false"
                  warnings="false"
                  configname="air">
                             
                  <source-path path-element="${test.src}" />
                  <source-path path-element="src/locales/{locale}" />

       

                  <library-path dir="${FLEX_HOME}/frameworks/libs/air" append="true">
                      <include name="*.swc" />
                  </library-path> 
                  <library-path dir="${FLEX_HOME}/frameworks/libs" append="true">
                      <include name="*.swc" />
                  </library-path>
                  <library-path dir="${FLEX_HOME}/frameworks/locale" append="true">
                      <include name="*.swc" />
                  </library-path>
                 
                  <library-path dir="${test.lib}" append="true">
                      <include name="*.swc" />
                  </library-path>
              </mxmlc> 
          </target>

       

       

           <target name="unit.tests">   
              <echo>Running unit tests...</echo>
             
              <flexunit
                  swf="${test.bin}/${test.app.name}.swf"
                  todir="${reports.dir}/tests"
                  haltonfailure="false"
                  verbose="true"
                  localTrusted="true"
                  failureproperty="failedtests" />
                     
              <junitreport todir="${reports.dir}/tests">
                  <fileset dir="${reports.dir}/tests">
                      <include name="TEST-*.xml"/>
                  </fileset>
             
                  <report format="frames" todir="${reports.dir}/tests"/>
              </junitreport>