Android and Code Coverage report

Put your problem here if it does not fit any of the other categories.

Android and Code Coverage report

Postby SirValerius » Wed Jun 23, 2010 11:56 am

hi guys i'm tryng to do some testing in my android application,

I've set-up my project in eclipse and I can successfully run my code. I've alredy written some JUnit test cases, now I'm tryng to generate a code coverage report. However it seems that there are different ways to accomplish this and the documantation is not very clear.

Can someone tell me what's the best solution considering that I've all my code in eclipse?
What steps do I need to take to get the reports.

(I've seen some posts about EMMA but the whole thing seems hackish and I'm not sure how it works when with eclipse, i.e. when the project is rebuilt).

Thank you in advice,
Posts: 2
Joined: Thu May 06, 2010 3:39 pm
Location: Rome(IT)


Re: Android and Code Coverage report

Postby candydhami » Mon Feb 28, 2011 6:01 am

i want to generate the HTml Report after running the junit testcase in android.Testcase are of type AndroidTestCase ,ProviderTestCase and ServiceTestCase.
and junit report task for this is :-

<project name="junitreport-problem" default="test" basedir=".">
<target name="test">
<path id="jarfilepath" >
<fileset dir="lib" >
<include name="*.jar" />
<junit printsummary="true" >
<classpath refid="jarfilepath" />
<classpath location="./bin" />
<!--type is xml, plain or brief. Best practice is xml-->
<!-- usefile attribute determines whether output should be sent
to a file -->
<formatter type="xml" usefile="true" />
<!-- we can use batchtest instead of test task in ant -->
<!-- <test todir="report" name ="" /> -->
<batchtest todir="report">
<fileset dir="src">
<include name="" />
<junitreport todir="report">
<fileset dir="report">
<include name="TEST-*.xml"/>
<report format="frames" todir="report/html"/>

This task is generating blank html Report,
please kindly help me in this regard,
Posts: 2
Joined: Tue Feb 22, 2011 8:26 am

Re: Android and Code Coverage report

Postby tekblom » Fri Mar 18, 2011 3:30 pm


I am also looking for a solution to use Code Coverage with android.

EMMA seems complicated though you need to run the source code for android.

I have looked at Maven as well and been able to set an environment to run tests. It should be easy to integrate a Code Coverage tool in Maven but I have not succeeded yet. Have also tried Gradle but are having a hard time with running the unit tests there.

Have you found any good solutions?

Have not tried to generate HTML-report yet but let you no if I try. !

Grateful for some experience report !

Once Poster
Once Poster
Posts: 1
Joined: Fri Mar 18, 2011 3:21 pm


Return to Other Coding-Problems

Who is online

Users browsing this forum: Google [Bot] and 6 guests