On Thu, Aug 27, 2009 at 7:53 PM, duykham<[email protected]> wrote: > Hi guys, > > Many thanks for your supports, it's now working with automatic test. > (adb shell am instrument ...) :) But, I have some questions that, > > 1. Is there a way to get EMMA code coverage with manual test? I mean, > we can test android by ourselves and after that, get the coverage > report for what we've done.
No, sorry there isn't. There's a lot of complexities because there are multiple processes involved, and when doing manual testing you wouldn't have control over when these processes start/stop and how to generate a coverage report. IMHO the data you would get from such an exercise might be of dubious value anyway, code coverage metrics are most relevant for white box testing techniques. > > 2. And, another question about packages that have static library. Does > any one successfully got the coverage of Browser app? And, as Brett > said, we must "make the static > library first with emma instrument on > > export EMMA_INSTRUMENT = true > make <name of static library> > mmm <path to package> " > > But, do you know the name of static library for Browser app? I tried > with com.android.dx.cf.code.SimException , but it seems not right! > Take a look at Browser's Android.mk file. You'll see the following line: LOCAL_STATIC_JAVA_LIBRARIES := google-framework so try doing: export EMMA_INSTRUMENT = true make google-framework mmm packages/apps/Browser > Any helps will be appreciated. > > Thank you very much! > > Duykham. > > On Aug 23, 9:58 pm, Maya <[email protected]> wrote: >> 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 <[email protected]> wrote: >> >> > 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 > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

