fix test coverage target

pull/14/head
Tim Su 13 years ago
parent 669583a3a9
commit 21d8b0326a

@ -5,10 +5,6 @@ tested.project.dir=../astrid
# output files and apk # output files and apk
out.dir=bin out.dir=bin
# source directory must be underneath output directory
# because we pull in from multiple source folders
source.dir=${out.dir}/source
# test runner: junit report test runner # test runner: junit report test runner
test.runner=com.zutubi.android.junitreport.JUnitReportTestRunner test.runner=com.zutubi.android.junitreport.JUnitReportTestRunner

@ -70,47 +70,33 @@
<echo> coverage: Run tests and dump emma coverage reports.</echo> <echo> coverage: Run tests and dump emma coverage reports.</echo>
</target> </target>
<target name="coverage" depends="android_test_rules.coverage"> <!-- override coverage target with custom reporting and rules -->
<antcall target="pull-emma-reports" /> <target name="coverage" depends="-set-coverage-classpath, -install-instrumented, install"
<antcall target="pull-junit" /> description="Runs the tests against the instrumented code and generates
</target> code coverage report">
<run-tests-helper emma.enabled="true">
<target name="-prepare-coverage-source"> <extra-instrument-args>
<subant target="copy-sources"> <arg value="-e" />
<fileset file="${tested.project.absolute.dir}/build.xml" /> <arg value="coverageFile" />
</subant> <arg value="${emma.dump.file}" />
<copy todir="${tested.project.absolute.dir}/bin/source"> </extra-instrument-args>
<fileset dir="../api/src" includes="**/*.java" /> </run-tests-helper>
<fileset dir="src" includes="**/*.java" />
</copy>
<!-- copy our own sources to source dir -->
<mkdir dir="${source.dir}" />
<copy todir="${source.dir}">
<fileset dir="src" />
</copy>
</target>
<target name="pull-junit">
<exec executable="${adb}" failonerror="true">
<arg line="${adb.device.arg}"/>
<arg value="pull" />
<arg value="/data/data/${tested.manifest.package}/files/junit-report.xml" />
<arg value="${reports.dir}/junit-report.xml" />
</exec>
</target>
<target name="pull-emma-repots" depends="-prepare-coverage-source">
<echo>Downloading coverage file into project directory...</echo> <echo>Downloading coverage file into project directory...</echo>
<exec executable="${adb}" failonerror="true"> <exec executable="${adb}" failonerror="true">
<arg line="${adb.device.arg}"/> <arg line="${adb.device.arg}" />
<arg value="pull" /> <arg value="pull" />
<arg value="${emma.dump.file}" /> <arg value="${emma.dump.file}" />
<arg value="coverage.ec" /> <arg value="coverage.ec" />
</exec> </exec>
<echo>Extracting coverage report...</echo> <echo>Extracting coverage report...</echo>
<copy todir="${tested.project.absolute.dir}/src-combined">
<fileset dir="../api/src" includes="**/*.java" />
</copy>
<mkdir dir="${reports.dir}" /> <mkdir dir="${reports.dir}" />
<emma> <emma>
<report sourcepath="${tested.project.absolute.dir}/${source.dir}" <report sourcepath="${tested.project.absolute.dir}/src-combined"
verbosity="${verbosity}"> verbosity="${verbosity}">
<infileset dir="."> <infileset dir=".">
<include name="coverage.ec" /> <include name="coverage.ec" />
@ -124,7 +110,18 @@
<delete dir="${instrumentation.absolute.dir}" /> <delete dir="${instrumentation.absolute.dir}" />
<delete file="coverage.ec" /> <delete file="coverage.ec" />
<delete file="coverage.em" /> <delete file="coverage.em" />
<echo>Saving the report file in ${basedir}/coverage/coverage.[html/xml]</echo> <echo>Saving the report file in ${basedir}/coverage/coverage.html</echo>
<antcall target="pull-junit" />
</target>
<target name="pull-junit">
<exec executable="${adb}" failonerror="true">
<arg line="${adb.device.arg}"/>
<arg value="pull" />
<arg value="/data/data/${tested.manifest.package}/files/junit-report.xml" />
<arg value="${reports.dir}/junit-report.xml" />
</exec>
</target> </target>
</project> </project>

Loading…
Cancel
Save