1. Add Instrumentation File
2. Add Entry to AndroidManifest.xml
<instrumentation android:name=".EmmaInstrumentation" android:targetPackage="" ></instrumentation>
This tag should be added above to the activity Tag.
3. Compile
ant clean
ant instrument
4. Install
ant installi
5. Launch Instrumented Application
adb shell am instrument -e coverage true -w <application_package>/.EmmaInstrumentation
Now execute the test scenarios and press back until you exit the app.
6. Generate HTML
- Make a new folder for test report generation say report.
- Open command prompt in this directory report.
- Copy
coverage.em
file from
to the current folder/bin - Pull the coverage.ec file from the device using command
adb pull /mnt/sdcard/coverage.ec .
- Copy emma.jar from the location
to the current location./tools/lib - To genarate the coverage report type the following command
java -cp emma.jar emma report -r html -in coverage.ec -sp
/src -in coverage.em
Note:
- Every time a new version of code is available, all the steps needs to be executed again, except for copying emma.jar from the sdk folder.
- for consecutive executions, first the old
coverage.ec
needs to be removed from/mnt/sdcard
.