You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by jz...@orange-ftgroup.com on 2010/08/05 08:17:29 UTC
Ant intergrate with Android Unit Test building
Hi,
Ant used by Java web or java application, when building the Unit test.
It can create a .html file to show the result.
<target name="junit" depends="instrument" description="Junit">
<!--<junit haltonfailure="no" printsummary="on"
errorProperty="test.failed" failureProperty="test.failed"
fork="true">-->
<junit printsummary="yes" haltonfailure="no" fork="true">
<sysproperty key="emma.coverage.out.file"
value="${coverage.absolute.dir}/coverage.emma" />
<jvmarg
value="-Demma.coverage.out.file=${coverage.absolute.dir}/metadata.emma"
/>
<jvmarg value="-Demma.coverage.out.merge=true" />
<classpath location="${instrument.absolute.dir}" />
<classpath location="${out.test-classes.absolute.dir}"
/>
<classpath refid="emma.lib" />
<formatter type="xml" />
<batchtest todir="${junit.absolute.dir}"
haltonfailure="no">
<fileset dir="${out.test-classes.absolute.dir}">
<include name="**/*Test.class" />
</fileset>
</batchtest>
</junit>
<junitreport>
<fileset dir="${junit.absolute.dir}">
<include name="TEST-*.xml" />
</fileset>
<report format="frames" todir="${junit.absolute.dir}"
/>
</junitreport>
<fail if="test.failed">
Tests failed. Check ${junit.absolute.dir}
</fail>
<antcall target="checkstyle" />
<antcall target="findbugs" />
<antcall target="build_html" />
<antcall target="pmd" />
<antcall target="gen-report-coverage" />
</target>
But when building the Android application Unit test, It cannot create
.html or .xml file to show the result, just only the log.
<macrodef name="run-tests-helper">
<attribute name="emma.enabled"
default="false" />
<element name="extra-instrument-args"
optional="yes" />
<sequential>
<echo>Running tests
...</echo>
<exec executable="${adb}"
failonerror="true">
<arg
value="shell" />
<arg
value="am" />
<arg
value="instrument" />
<arg
value="-w" />
<arg
value="-e" />
<arg
value="coverage" />
<arg
value="@{emma.enabled}" />
<extra-instrument-args />
<arg
value="${manifest.package}/${test.runner}" />
</exec>
</sequential>
</macrodef>
And I want to know whether building android application can same as jave
web or jave application building? Can create a .html or .xml file to
show the result?
Thank you
Best Regards
Jianmin