Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
EMMA Code coverage and JUnit
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  Messages 1 - 25 of 32 - Collapse all  -  Translate all to Translated (View all originals)   Newer >
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Deeps  
View profile  
 More options May 8, 7:19 am
From: Deeps <L.Prade...@gmail.com>
Date: Fri, 8 May 2009 04:19:09 -0700 (PDT)
Local: Fri, May 8 2009 7:19 am
Subject: EMMA Code coverage and JUnit
I had been surfing for the past one month on this Code coverage. But
its disappointing that there is no clear documentation on using EMMA
code coverage for Android.

case 1: I am trying to execute from Command prompt.
I have sucessfully implemented instrumentation class for my
application. I would like to go for code coverage. I executed the
following command in the cmd line:

adb shell am instrument -w -e coverage true com.android.app/
android.test.InstrumentationTestRunner

adb shell am instrument -w -e coverageFile /sdcard/codefile.ec
com.android.app/android.test.InstrumentationTestRunner

Also i have configured to run with sdcard.. I could see that all my
test cases are executed but no coverage file is generated at '/
sdcard'.

case 2: I am trying to execute from eclipse.
When i did all coverage configuration settings and try to run the
application, it pops up a message saying,
" No coverage data file has been written during this coverage session.
Please make sure that your application does NOT include EMMA run time
libraries or EMMA configurations.Do not terminate java process
manually from Eclipse"

Please do clarify my error.

Is there a right solution to get the code coverage for Android
applications...?

Pradeepa


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
天山雪  
View profile  
 More options May 10, 10:53 pm
From: 天山雪 <xuey.b...@gmail.com>
Date: Sun, 10 May 2009 19:53:58 -0700 (PDT)
Local: Sun, May 10 2009 10:53 pm
Subject: Re: EMMA Code coverage and JUnit
1. did you download and set classpath for emma.jar?
2. after that, you could get coverage.ec file.
But it's not right file for coverage report in my test. Perhaps other
things need to be done.
currently I don't know how to get an emma instrumented build, which is
needed for coverage test.

On 5月8日, 下午7时19分, Deeps <L.Prade...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Richard Cook  
View profile  
 More options May 11, 8:00 pm
From: Richard Cook <richardgc...@gmail.com>
Date: Mon, 11 May 2009 17:00:09 -0700
Local: Mon, May 11 2009 8:00 pm
Subject: Re: [android-developers] Re: EMMA Code coverage and JUnit

I as well am looking to understand how  o build an emma instrumented test.
I am unable to find any information on EMMA through SDK or through the web.

Maybe the three of us can pool our resources and keep this thread alive to
a.) get noticed, b.) get some code coverage.

For those catching on:
http://emma.sourceforge.net/intro.html is the place to download EMMA (I
assume). It may also be included in the SDK, I haven't verified this. It may
need to be modified to run with Android?

The command lines above work for me, but no files are generated. I have
added EMMA to the build path.

Has anyone had any luck yet? I've also considered Clover as an alternative
to generating reports, but I have no progress there either.

2009/5/10 天山雪 <xuey.b...@gmail.com>


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Felipe Ramos  
View profile  
 More options May 13, 2:06 pm
From: Felipe Ramos <felipe.wo...@gmail.com>
Date: Wed, 13 May 2009 11:06:00 -0700 (PDT)
Subject: Re: EMMA Code coverage and JUnit
Hi guys,

I don't know if this thread is still active, but I spent some hours
trying to make the EMMA instrumented code generation works.

I actually came pretty close of getting it, I think. You can use the
EMMA_INSTRUMENT:=true on the project Android.mk file to turn on the
EMMA instrumentation for that project. Everything seems to work, but
at the end I get a bizarre error on Calendar Tests:

target Java: Calendar (out/target/common/obj/APPS/
Calendar_intermediates/classes)
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
EMMA: processing instrumentation path ...
EMMA: instrumentation path processed in 703 ms
EMMA: [119 class(es) instrumented, 11 resource(s) copied]
EMMA: metadata merged into [/work/android3/out/target/common/obj/APPS/
Calendar_intermediates/coverage.em] {in 51 ms}
Copying: out/target/common/obj/APPS/Calendar_intermediates/classes.jar
target Dex: Calendar

UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dx.cf.code.SimException: local variable type mismatch:
attempt to set or access a value of type java.lang.String[] using a
local variable of type java.lang.String. This is symptomatic of .class
transformation tools that ignore local variable information.
        at com.android.dx.cf.code.BaseMachine.throwLocalMismatch
(BaseMachine.java:537)
        at com.android.dx.cf.code.BaseMachine.getLocalTarget(BaseMachine.java:
392)
        at com.android.dx.cf.code.BaseMachine.storeResults(BaseMachine.java:
519)
        at com.android.dx.cf.code.ValueAwareMachine.run
(ValueAwareMachine.java:196)
        at com.android.dx.cf.code.RopperMachine.run(RopperMachine.java:290)
        at com.android.dx.cf.code.Simulator$SimVisitor.visitLocal
(Simulator.java:542)
        at com.android.dx.cf.code.BytecodeArray.parseInstruction
(BytecodeArray.java:472)
        at com.android.dx.cf.code.Simulator.simulate(Simulator.java:96)
        at com.android.dx.cf.code.Ropper.processBlock(Ropper.java:681)
        at com.android.dx.cf.code.Ropper.doit(Ropper.java:636)
        at com.android.dx.cf.code.Ropper.convert(Ropper.java:253)
        at com.android.dx.dex.cf.CfTranslator.processMethods
(CfTranslator.java:252)
        at com.android.dx.dex.cf.CfTranslator.translate0(CfTranslator.java:
131)
        at com.android.dx.dex.cf.CfTranslator.translate(CfTranslator.java:85)
        at com.android.dx.command.dexer.Main.processClass(Main.java:297)
        at com.android.dx.command.dexer.Main.processFileBytes(Main.java:276)
        at com.android.dx.command.dexer.Main.access$100(Main.java:56)
        at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:
228)
        at com.android.dx.cf.direct.ClassPathOpener.processArchive
(ClassPathOpener.java:245)
        at com.android.dx.cf.direct.ClassPathOpener.processOne
(ClassPathOpener.java:130)
        at com.android.dx.cf.direct.ClassPathOpener.process
(ClassPathOpener.java:108)
        at com.android.dx.command.dexer.Main.processOne(Main.java:245)
        at com.android.dx.command.dexer.Main.processAllFiles(Main.java:183)
        at com.android.dx.command.dexer.Main.run(Main.java:139)
        at com.android.dx.command.dexer.Main.main(Main.java:120)
        at com.android.dx.command.Main.main(Main.java:87)
...at bytecode offset 000000b7
locals[0000]: Lcom/google/android/googleapps/IGoogleLoginService$Stub;
locals[0001]: I
locals[0002]: Landroid/os/Parcel;
locals[0003]: Landroid/os/Parcel;
locals[0004]: I
locals[0005]: <invalid>
locals[0006]: <invalid>
locals[0007]: <invalid>
locals[0008]: <invalid>
locals[0009]: [Z
...while working on block 00b7
...while working on method onTransact:(ILandroid/os/Parcel;Landroid/os/
Parcel;I)Z
...while processing onTransact (ILandroid/os/Parcel;Landroid/os/
Parcel;I)Z
...while processing com/google/android/googleapps/IGoogleLoginService
$Stub.class

1 error; aborting

Really strange error. I'll keep trying to find out how to fix this.

Thanks

Felipe

On May 11, 9:00 pm, Richard Cook <richardgc...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Felipe Ramos  
View profile  
(1 user)  More options May 14, 10:25 am
From: Felipe Ramos <felipe.wo...@gmail.com>
Date: Thu, 14 May 2009 07:25:54 -0700 (PDT)
Local: Thurs, May 14 2009 10:25 am
Subject: Re: EMMA Code coverage and JUnit
Hi everyone

I discovered a way of getting the android code instrumented, using the
full source from google.

On the project Android.mk I added the line EMMA_INSTRUMENT:=true and
voilá, it instrumented the code. Now I'm facing problems to run the
instrumented code. Although emma.jar is inside the image and installed
correctly during emulator startup, I keep getting errors that indicate
that Android is not being able to find the classes provided by emma. I
tried to force the usage of emma library by adding on the test
manifest  <uses-library android:name="emma" /> but if I do that, it
does not allow me to install the test application because Android
thinks that emma library is missing.

Does anyone have any ideas that I could try to fix this problem. I
really think I'm near of solving this puzzle, but I could not find the
last part yet.

On May 11, 9:00 pm, Richard Cook <richardgc...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Deeps  
View profile  
(1 user)  More options May 21, 9:00 am
From: Deeps <L.Prade...@gmail.com>
Date: Thu, 21 May 2009 06:00:33 -0700 (PDT)
Local: Thurs, May 21 2009 9:00 am
Subject: Re: EMMA Code coverage and JUnit
Felipe Ramos,

Did u end up somewhere..? I am not able to go ahead with this......

deeps


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Felipe Ramos  
View profile  
(1 user)  More options May 21, 12:25 pm
From: Felipe Ramos <felipe.wo...@gmail.com>
Date: Thu, 21 May 2009 09:25:13 -0700 (PDT)
Local: Thurs, May 21 2009 12:25 pm
Subject: Re: EMMA Code coverage and JUnit
Hi deeps,

I'm stuck on the point where I need to run the instrumented tests on
the emulator. I could not find a way yet to make the emulator believe
that the emma.jar is already installed on it.

Also, I don't know if there is a way of enabling EMMA instrumentation
using the SDK. I have not tried that yet. I'm using the android full
source, compiling it from scratch. I think I'm close, at least to run
it on the emulator, but on this past week I was too busy and could not
investigate more about this issue. I'm planning to put everything I
know on a blog or something like that, at least to help the other
developers that are trying to make EMMA work on Android, since I could
not find relevant references on this matter from the Google guys.

I'll send later a step by step of what I made up to now... I'm
currently at my job, so I don't have much time to write right now.

BR

Felipe

On May 21, 10:00 am, Deeps <L.Prade...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Deeps  
View profile  
 More options May 26, 2:26 am
From: Deeps <L.Prade...@gmail.com>
Date: Mon, 25 May 2009 23:26:50 -0700 (PDT)
Local: Tues, May 26 2009 2:26 am
Subject: Re: EMMA Code coverage and JUnit
Felipe,

Atlast i am half way through in getting the coverage file. But..I dont
see any required output in that file.

I created a sdcard. Then i run my Instrumentation with the following
command,
# am instrument -e coverage true -w com.app.exam.tests/
android.test.InstrumentationTestRunner

First I got error, Is EMMA jar included.

So, i added the amma.jar in the build path. Again I ran the same
command. Then, I found a coverage file , "coverage.ec" while
navigating thro file explorer of ddms. I pulled it to the desktop and
imported the session to Coverage field in eclipse.

Its unfortunate that I dont see any code coverage but i could see only
the number of instructions.Even though my test cases has run and the
results has displayed, I am getting 0.0% code coverage..

Can u please try this and share ur experience..

Deeps

On May 21, 9:25 pm, Felipe Ramos <felipe.wo...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Felipe Ramos  
View profile  
(1 user)  More options May 27, 8:33 am
From: Felipe Ramos <felipe.wo...@gmail.com>
Date: Wed, 27 May 2009 09:33:49 -0300
Local: Wed, May 27 2009 8:33 am
Subject: Re: [android-developers] Re: EMMA Code coverage and JUnit

Hi Deeps,
Nice to hear that you are making progress. Are you using only the SDK, or
are you building the entire android source code? Maybe your code is not
instrumented to generate the coverage statistics and this would be why you
are getting 0% of code coverage. Are you using the emma.jar provided on the
Emma site, or the one built in Android source code??
I'll try to reproduce what you have done up to now here. I hope we can
manage to get a final solution for this matter.
BR
Felipe


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Deeps  
View profile  
(1 user)  More options May 28, 12:25 am
From: Deeps <L.Prade...@gmail.com>
Date: Wed, 27 May 2009 21:25:11 -0700 (PDT)
Local: Thurs, May 28 2009 12:25 am
Subject: Re: EMMA Code coverage and JUnit
Thanks a lot Felipe.

Yeah..I have included emma.jar in the build path of my application.
I have the android latest release 1.5 sdk.. However, my application
has 1.1 target. I tried using Android JUnit and found all my test
cases are executed.
And also throu command prompt i followed the syntax mentioned in the
earlier post..

Still coverage is 0.0% but i could see the no of instructions. Will
there be a solution?

Thanks
Deeps

On May 27, 5:33 pm, Felipe Ramos <felipe.wo...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Brett Chabot  
View profile  
(1 user)  More options May 28, 4:09 pm
From: Brett Chabot <brettcha...@android.com>
Date: Thu, 28 May 2009 13:09:02 -0700
Local: Thurs, May 28 2009 4:09 pm
Subject: Re: [android-developers] Re: EMMA Code coverage and JUnit

+ android-platform

Its great to see people interested in EMMA code coverage on Android.
However, note that EMMA code coverage support on Android is currently quite
preliminary. Its not supported from within the SDK yet. The support that is
in place is for apps and tests that are part of the android source tree.

That being said, if you still want to give it a try, download the android
source for cupcake, do a full build, and give the instructions below a try.
There are a couple helper scripts that have been created which will
hopefully make this a bit easier.
1. Generating code coverage for your own tests using runtest script

First, you need to add the target system/framework/emma.jar to the device's
boot classpath. Modify the BOOTCLASSPATH variable in
/system/core/rootdir/init.rc. The system/framework/emma.jar entry needs to
be added in the exact position shown below:

 export BOOTCLASSPATH=/system/framework/core.jar:/system/framework/ext.jar:
*/system/framework/emma.jar:*
/system/framework/framework.jar:/system/framework/android.policy.jar:/syste m/framework/services.jar

 Rebuild the bootimage to pick up the init.rc changes:

make bootimage

  Start an emulator with a simulated sdcard:

emulator -sdcard <path to sdcard.img>&

  Note that the emulator will not fully boot up at this point since the
emma.jar file is not present yet.

Next, use the runtest.py script. Runtest will do all the necessary steps to
instrument your test and target package, run the test, and generate the code
coverage report.

% runtest_py --coverage apidemos
...
Coverage report generated at <android build
root>/out/emma/ApiDemos/apidemos/apidemos.html

 When testing on the emulator, you must launch the emulator with a simulated
sdcard (-sdcard option), as code coverage results are stored to the sdcard.
To use runtest_py, the test must be defined in
development/testrunner/test_defs.xml.
To generate code coverage results, the test must have a "coverage_target"
attribute, which must refer to a target defined in
development/testrunner/coverage_targets.xml

2. Generating code coverage for your own tests - The Hard Way

The following steps will use apidemos tests as an example, and will assume
the current working path is the android build root.

Modify the targets BOOTCLASSPATH as described in the preceding section.

Before doing a build, set

export EMMA_INSTRUMENT=true

 This instructs the build system to add the necessary emma instrumentation
to the generated bytecode.

mmm development/samples/ApiDemos

 Pass in a '-e coverage true' argument to adb shell am instrument when
executing tests.

adb shell am instrument -w -e coverage true
com.example.android.apis.tests/android.test.InstrumentationTestRunner

 This command will dump a runtime coverage data file at
/sdcard/coverage.econ the device. Extract it to local host

adb pull /sdcard/coverage.ec coverage.ec

 Now generate a coverage report. You'll need to pass in the path to the
coverage metadata generated at build time.

java -cp external/emma/lib/emma.jar emma report -r html -in
coverage.ec -sp development/samples/ApiDemos/src -in
out/target/common/obj/APPS/ApiDemos_intermediates/coverage.em

I hope this helps.

Regards,
Brett.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Felipe Ramos  
View profile  
 More options Jun 2, 8:33 am
From: Felipe Ramos <felipe.wo...@gmail.com>
Date: Tue, 2 Jun 2009 09:33:42 -0300
Local: Tues, Jun 2 2009 8:33 am
Subject: Re: [android-developers] Re: EMMA Code coverage and JUnit

Hi Brett,
Thanks a lot for all the info provided!!! I was missing some of the steps
you mentioned, that is why it was not working well over here. Even knowing
that the EMMA support is quite preliminary, I will certainly give it a try.
UT + code coverage are really important to help us obtain better and more
stable code. Thanks again!
Best Regards
Felipe

On Thu, May 28, 2009 at 5:09 PM, Brett Chabot <brettcha...@android.com>wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Haritha  
View profile  
 More options Jul 10, 5:32 pm
From: Haritha <hari.andr...@gmail.com>
Date: Fri, 10 Jul 2009 14:32:29 -0700 (PDT)
Local: Fri, Jul 10 2009 5:32 pm
Subject: Re: EMMA Code coverage and JUnit
Brett
first of all thanks for all the information on Emma coverage.
I have written my own instrument testcase for Setting  app and added
these to /packages/apps/Settings/tests/
with export EMMA_INSTRUEMNT=true;and mmm packages/apps/Setting
coverage.em,Settings.apk,SettingsTests.apk are generated.
But when i do adb shell am instrument -w -e coverage true
com.android.settings.tests/android.test.InstruementationTestRunner
 all the tests are performed on emulator but its giving error Error:
Failed to generate emma coverage.

i was able to generate reports for all apps that come with build
(apidemos,Calculator etc).
Is it possible to generate coverage through the tests that wont come
with android.If so what am i missing?
Are there any suggested solutions?
Any help is really appreciated.
thanks and regards
haritha

On May 28, 1:09 pm, Brett Chabot <brettcha...@android.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
duykham  
View profile   Translate to Translated (View Original)
 More options Aug 17, 6:57 am
From: duykham <duyk...@gmail.com>
Date: Mon, 17 Aug 2009 03:57:28 -0700 (PDT)
Local: Mon, Aug 17 2009 6:57 am
Subject: Re: EMMA Code coverage and JUnit
Haritha,

I think you got the issue of SD card. It is not writable, so that the
coverage.ec can not be saved into SDcard.

You can get more detail about this issue here: https://review.source.android.com/#change,9452

Hope this helps.

BR.

Haritha のメッセージ:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
duykham  
View profile  
 More options Aug 19, 12:16 am
From: duykham <duyk...@gmail.com>
Date: Tue, 18 Aug 2009 21:16:17 -0700 (PDT)
Local: Wed, Aug 19 2009 12:16 am
Subject: Re: EMMA Code coverage and JUnit
Hi Brett,

Thanks for your help. But, for me, there's something not clearly, so
that I need more supports from you.

1. Firstly, as you said,

"Before doing a build, set

export EMMA_INSTRUMENT=true"

a. Did you mean "doing a build" is building entire source code of
Android or just re-making images?

b. And, when we re-make images, do we need to make both bootimage and
system image or just do with bootimage?

c. And, after that, do we need to sync new images with the emulator? I
mean, run the command: "adb sync". or something like that?

2. Second, if I set EMMA_INSTRUMENT=true before making images or
building from source code, I always got the error with
com.android.dx.cf.code.SimException:, which is exactly mentioned in
here: http://code.google.com/p/android/issues/detail?id=3080.

So that, i can not run the EMMA coverage after that.

Do you have any solutions for this? Your help will be very appreciated
for me!

Thanks and best regards,

Duykham


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Brett Chabot  
View profile  
(2 users)  More options Aug 19, 11:43 pm
From: Brett Chabot <brettcha...@android.com>
Date: Wed, 19 Aug 2009 20:43:17 -0700
Local: Wed, Aug 19 2009 11:43 pm
Subject: Re: [android-developers] Re: EMMA Code coverage and JUnit
Comments inclosed

On Tue, Aug 18, 2009 at 9:16 PM, duykham<duyk...@gmail.com> wrote:

> Hi Brett,

> Thanks for your help. But, for me, there's something not clearly, so
> that I need more supports from you.

> 1. Firstly, as you said,

> "Before doing a build, set

> export EMMA_INSTRUMENT=true"

> a. Did you mean "doing a build" is building entire source code of
> Android or just re-making images?

You don't necessarily need to have EMMA_INSTRUMENT set when doing a
full build, you only need to build the packages you want to measure
with code coverage. For example, if you're interested in measuring the
coverage of ApiDemos, I'd recommend the following exact steps

# ensure emulator is NOT launched
edit init.rc to add emma.jar to the BOOTCLASSPATH as described in my
earlier mail
make bootimage # not sure this is necessary since next step will do a full build
make -j4 # to build the full system image
export EMMA_INSTRUMENT=true"
make emma # builds the emma jar itself
mmm development/samples/ApiDemos
emulator -sdcard <path to sdcard>
adb sync # just to be safe

> b. And, when we re-make images, do we need to make both bootimage and
> system image or just do with bootimage?

You only need to rebuild bootimage if you've changed init.rx

> c. And, after that, do we need to sync new images with the emulator? I
> mean, run the command: "adb sync". or something like that?

Yes

> 2. Second, if I set EMMA_INSTRUMENT=true before making images or
> building from source code, I always got the error with
> com.android.dx.cf.code.SimException:, which is exactly mentioned in
> here: http://code.google.com/p/android/issues/detail?id=3080.

I think this error only occurs when trying to build a package with
emma instrumentation, which includes a static library that has not
gone through emma instrumentation. If you try to make the static
library first with emma instrument on, that might help get around the
problem. ie

export EMMA_INSTRUMENT = true
make <name of static library>
mmm <path to package>


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Gabor  
View profile  
(3 users)  More options Aug 20, 9:08 am
From: Gabor <gabor.andr...@googlemail.com>
Date: Thu, 20 Aug 2009 06:08:19 -0700 (PDT)
Local: Thurs, Aug 20 2009 9:08 am
Subject: Re: EMMA Code coverage and JUnit
Hi All,

Finally, the emma code coverage measurement is working for me (for a
custom project). So here are the steps what you need to make it work
(I have tested it, with Java 1.5 on Ubuntu 8.04):

mkdir android-src
cd android-src
repo init -u git://android.git.kernel.org/platform/manifest.git -b
cupcake
repo sync

# Add emma.jar to the system/core/rootdir/init.rc
sed 's/\/system\/framework\/core.jar:\/system\/framework\/ext.jar:/\/
system\/framework\/core.jar:\/system\/framework\/ext.jar:\/system\/
framework\/emma.jar:/' system/core/rootdir/init.rc > system/core/
rootdir/init.rc.tmp
mv system/core/rootdir/init.rc.tmp system/core/rootdir/init.rc

# Rebuild the boot image
make bootimage

# To build the full system image
make -j4

# Set the PATH:
export PATH=${PATH}:/<_path_>/android-src/out/host/linux-x86/bin/

# Build the emma jar itself
make emma

# Setting the environment and additional bash commands. (like
m,mm,mmm, choosecombo etc) Notice the space after the dot!
. build/envsetup.sh

# Set EMMA_INSTRUMENTATION to true
export EMMA_INSTRUMENT=true

# Copy your project to development/samples/<_projectname_> or
somewhere..:)
# Based on the ApiDemo create an Android.mk file for the project
directory and the project test directory
# The LOCAL_INSTRUMENTATION_FOR value in test dir Android.mk has to be
equal with the LOCAL_PACKAGE_NAME defined in the Android.mk in the
main project dir.
# Compile the Application would like to instrument
mmm development/samples/<_projectname_>

# Set the ANDROID_PRODUCT_OUT directory for the emulator to know the
image location
export ANDROID_PRODUCT_OUT=/<_path_>/android-src/out/target/product/
generic

# Start an emulator with a simulated sdcard:
emulator -sdcard <path to sdcard>

# Remount the drive - it is needed to have a writable drive. without
that sync wont work
adb remount

# Synchronize the local content with the emulator
adb sync

adb shell
# create directory: mkdir /etc/coverageresult

# Executing tests
adb shell am instrument -w -e coverage true -e coverageFile /etc/
coverageresult/coverage.ec hu.agsoftware.sample.tests/
android.test.InstrumentationTestRunner

# Dump a runtime coverage data file:
adb pull /etc/coverageresult/coverage.ec coverage.ec

# Generate a coverage report
java -cp external/emma/lib/emma.jar emma report -r html -in
coverage.ec -sp development/samples/<_projectname_>/src -in out/target/
common/obj/APPS/<_projectname>_intermediates/coverage.em

I hope it helps.

Gabor


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Maya  
View profile  
 More options Aug 22, 8:12 am
From: Maya <mayankgupt...@gmail.com>
Date: Sat, 22 Aug 2009 05:12:56 -0700 (PDT)
Local: Sat, Aug 22 2009 8:12 am
Subject: Re: EMMA Code coverage and JUnit
Thanks Gabor, indeed it's a very useful information.
Am getting an error while building the project, it says:
make: *** [out/host/linux-x86/obj/EXECUTABLES/emulator_intermediates/
android/skin/window.o] Error 1
seems some problem with emulator skin.
Have you faced this, or else can you let me know how to correct this
error.
Urgent reply required, as am just stuck and not able to proceed.

Thanks

On Aug 20, 6:08 pm, Gabor <gabor.andr...@googlemail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tim  
View profile  
 More options Aug 23, 5:59 pm
From: Tim <tim...@gmail.com>
Date: Sun, 23 Aug 2009 14:59:29 -0700 (PDT)
Local: Sun, Aug 23 2009 5:59 pm
Subject: Re: EMMA Code coverage and JUnit
Just to follow that up, I was able to get it working as well for a
custom project (thanks Gabor!). I had to make some minor changes to
the instructions to get it all to work for me, particularly with the
SDCard on cupcake. If folks are interested, here's what I did:

http://blog.lv25.com/2009/08/emma-code-coverage-for-your-android.html

Tim

On Aug 20, 6:08 am, Gabor <gabor.andr...@googlemail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Maya  
View profile  
 More options Aug 23, 10:58 am
From: Maya <mayankgupt...@gmail.com>
Date: Sun, 23 Aug 2009 07:58:25 -0700 (PDT)
Local: Sun, Aug 23 2009 10:58 am
Subject: Re: EMMA Code coverage and JUnit
hey Gabor,
thanks a lot for your help.
Actually i tried reproducing the same steps, it is working fine till
emulator starts, it launches emulator but it does not shows the home
screen
i tried steps after that, doing adb remount and adb sync, it pushes
all the neccessay files into the emulator, but emulator is still in
sleep state, just the first screen saying Android.. keeps up, does not
boot after that.
Then i tries running test cases using 'am' command no tests run and no
coverage file got generated.
Can  you tell me whats the problem in this.(all the bulding process wa
successfully passed with no errors)

Thanks,
Mayank

On Aug 20, 6:08 pm, Gabor <gabor.andr...@googlemail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mayank Gupta  
View profile  
 More options Aug 24, 8:12 am
From: Mayank Gupta <mayank_thapar2...@yahoo.co.in>
Date: Mon, 24 Aug 2009 05:12:10 -0700 (PDT)
Local: Mon, Aug 24 2009 8:12 am
Subject: Re: EMMA Code coverage and JUnit
has anyone stuck with the problem on android OS not booting while
launching emulator showing error that can not specify non '.' in your
classpath,
 unable to launch dalvikvm

On Aug 20, 6:08 pm, Gabor <gabor.andr...@googlemail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Haritha  
View profile  
 More options Aug 24, 5:23 pm
From: Haritha <hari.andr...@gmail.com>
Date: Mon, 24 Aug 2009 14:23:27 -0700 (PDT)
Local: Mon, Aug 24 2009 5:23 pm
Subject: Re: EMMA Code coverage and JUnit
thanks everyone for posting info on emma coverage.I was also able to
generate coverage reports for custom tests with necessary changes to
vold.conf.
regards
Haritha

On Aug 20, 6:08 am, Gabor <gabor.andr...@googlemail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
santosh kumar  
View profile  
 More options Aug 25, 5:40 am
From: santosh kumar <santosh.1...@gmail.com>
Date: Tue, 25 Aug 2009 02:40:33 -0700 (PDT)
Local: Tues, Aug 25 2009 5:40 am
Subject: Re: EMMA Code coverage and JUnit
Hi All,

what changes you have been done to vold.conf?

and i followed the steps of gobor..

but for me also, emulator is getting stucked..

can you plz help me..

On Aug 25, 2:23 am, Haritha <hari.andr...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
hari uppalapati  
View profile  
 More options Aug 25, 5:28 pm
From: hari uppalapati <hari.andr...@gmail.com>
Date: Tue, 25 Aug 2009 14:28:17 -0700
Local: Tues, Aug 25 2009 5:28 pm
Subject: Re: [android-developers] Re: EMMA Code coverage and JUnit

hi
i was not facing any issues with emulator.Only thing was my coverage.ec file
was empty as my sdcard is not recognised.with the following steps the issues
was resolved.If possible post the logcat o/p and also the steps followed.
1) edit system/core/rootdir/Android.mk so that the copy_from variable on
line 6 contains etc/vold.conf.
copy_from := \
    etc/dbus.conf \
    etc/vold.conf \
    etc/init.goldfish.sh \
    etc/hosts

2)copy vold.conf from (git://
android.git.kernel.org/platform/vendor/htc/dream-open.git) to
system/core/rootdir/etc/
     cp vendor/htc/dream-open/vold.conf system/core/rootdir/etc.
regards
Haritha

On Tue, Aug 25, 2009 at 2:40 AM, santosh kumar <santosh.1...@gmail.com>wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
santosh kumar  
View profile  
 More options Aug 25, 9:39 pm
From: santosh kumar <santosh.1...@gmail.com>
Date: Tue, 25 Aug 2009 18:39:44 -0700 (PDT)
Local: Tues, Aug 25 2009 9:39 pm
Subject: Re: EMMA Code coverage and JUnit
Hi All,

I have few questions about this.. plz clarify me..

i want to generate code coverage for apidemos only...

first i changed init.rc then i followed every thing which is mentioned
in gobor mail..

one thing i am not understanding... when i start the emulator,
emulator is getting stucked with the boot up logo,

i have seen some other artical... we need to run runtest.py?

is it correct?

why emulator is getting stucked?

Thanks
Santosh

On Aug 26, 2:28 am, hari uppalapati <hari.andr...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Messages 1 - 25 of 32   Newer >
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google