Reputation: 8434
After running ant clean emma debug
and installing the generated apk file on my emulator, I am running the following command to run my unit tests:
adb shell am instrument -w -e package org.company.projectname.test.unit -e coverage true \
-e coverageFile ProjectNameTest/bin/coverage.xml org.company.projectname.tests/com.neenbedankt.android.test.InstrumentationTestRunner'
The InstrumentationTestRunner I am using is a subclass of android.test.InstrumentationTestRunner
.
When I run this command, all the tests pass, but then no coverage is generated and I get the error:
Error: Failed to generate emma coverage. Is emma jar on classpath?
I am not looking for a solution that uses ant test
, unless that solution can address the reason I' not using it, which is that I wanted to be able to specify a package within org.company.projectname.test
to test (in this case the unit
package).
Upvotes: 1
Views: 4389
Reputation: 37147
This worked for me:
ant instrument
ant emma installi test
Edit: If you do not want to use Ant you have to build the instrumented apk manually, check $ANDROID_HOME/tools/ant/build.xml for more info and make sure emma.jar is under libs of your test project.
Upvotes: 1
Reputation: 133
Try : ant all clean emma debug install test
and also please check http://code.google.com/p/android/issues/detail?id=21640 , it seems like this issue is fixed latest commit
Upvotes: 0