wmbest.com
  • Home
  • About
Follow

Android Coverage and Hudson/Jenkins

Apr18
2011
Leave a Comment Written by Bill

Recently we set up a Hudson continuous integration server at work. We are developing android apps and when I found out that Hudson had an Emma plugin I got excited. I found out about emma and android’s coverage reports. There was however one problem. Android’s <code>ant coverage</code> build will only output an html report. The hudson plugin requires an xml report.

To fix this I created a new build action in my build.xml. This is actually word for word what is in the coverage target with one minor change.

<target name="coverage-xml" 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 -->
                <infileset dir=".">
                    <include name="coverage.ec" />
                    <include name="coverage.em" />
                </infileset>
                <!-- TODO: reports in other, indicated by user formats -->
                <xml outfile="coverage.xml" />
            </report>
        </emma>
        <echo>Cleaning up temporary files...</echo>
        <delete dir="${instrumentation.absolute.dir}" />
        <delete file="coverage.ec" />
        <delete file="coverage.em" />
        <echo>Saving the report file in ${basedir}/coverage/coverage.xml</echo>
    </target>

Here you can see the only real change to the target is this line:

<xml outfile="coverage.xml" />

as opposed to this

<html outfile="coverage.html" />

. Now we can output our coverage report to our workspace and feed it to the Hudson Emma plugin.

Posted in Uncategorized
SHARE THIS Twitter Facebook Delicious StumbleUpon E-mail
← Business Objects 3.1 and Active Directory 2008 R2

No Comments Yet

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

*

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Recent Posts

  • Android Coverage and Hudson/Jenkins
  • Business Objects 3.1 and Active Directory 2008 R2
  • Site downtime
  • Pythons and Pandas
  • Wmbest.com and future development

Recent Comments

Calendar

May 2012
M T W T F S S
« Apr    
 123456
78910111213
14151617181920
21222324252627
28293031  

Tags

Android Blender c++ crash bandicoot general News panda Programming Python web

Archives

  • April 2011
  • September 2010
  • April 2010

Meta

  • Log in

EvoLve theme by Theme4Press  •  Powered by WordPress wmbest.com