Skip to content

Instantly share code, notes, and snippets.

@fredgrott
Created June 1, 2011 14:47
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fredgrott/1002438 to your computer and use it in GitHub Desktop.
Save fredgrott/1002438 to your computer and use it in GitHub Desktop.
android test_rules_coverage-target
test_rules is incorrect for coverage target for the coverage file locations and report generation..correcteed to:
<target name="coverage" depends="-set-coverage-classpath, -install-instrumented, install"
description="Runs the tests against the instrumented code and generates
code coverage report">
<run-tests-helper emma.enabled="true">
<extra-instrument-args>
<arg value="-e" />
<arg value="coverageFile" />
<arg value="${emma.dump.file}" />
</extra-instrument-args>
</run-tests-helper>
<echo>Downloading coverage file into project directory...</echo>
<exec executable="${adb}" failonerror="true">
<arg line="${adb.device.arg}" />
<arg value="pull" />
<arg value="${emma.dump.file}" />
<arg value="coverage.ec" />
</exec>
<echo>Extracting coverage report...</echo>
<emma>
<report sourcepath="${tested.project.absolute.dir}/${source.dir}"
verbosity="${verbosity}">
<!-- TODO: report.dir or something like should be introduced if necessary -->
<!-- per sdk 11/adt 10.01 its wrong
-->
<infileset file="${tested.project.absolute.dir}/build/docs/coverage.ec" />
<infileset file="${tested.project.absolute.dir}/coverage.em"/>
<!-- TODO: reports in other, indicated by user formats -->
<html outfile="${tested.project.absolute.dir}/build/docs/coverage.html" />
</report>
</emma>
<echo>Cleaning up temporary files...</echo>
<delete dir="${instrumentation.absolute.dir}" />
<!-- coverage.ec file appears in build/docs and
coverage.em appears in app project/root
thus we need to specify location-->
<delete file="${tested.project.absolute.dir}/build/docs/coverage.ec" />
<delete file="${tested.project.absolute.dir}/coverage.em" />
<echo>Saving the report file in ${basedir}/coverage/coverage.html</echo>
</target>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment