2

Is it possible to get code coverage of my android app using jococo and appium? From what I understand, Appium takes the built apk and uses that for running the tests. So, is there any way around this so that we can enable code coverage?

1 Answer 1

3

Yes, it’s possible to get code coverage using Appium. We had similar issue few years back on using Appium and Emma (not Jococo, but I believe your problem can be solved using the same technique used by my team).

To get the instrumentation detail, in console type "adb shell pm list instrumentation" after you installed the instrumented app on to your device/emulator. Copy the whole path

desiredCapabilities.setCapability("androidCoverage", "<instrumentation >");

Call this method when your test case is end and just before you quit the driver.

driver.endTestCoverage("com.intuit.turbotaxuniversal.END_EMMA", "/data/local/coverage/coverage.ec"); 

Also refer to following commits:

https://github.com/appium/appium/issues/1889 https://github.com/appium/appium/blob/0.18.x/docs/en/android_coverage.md

Hope this helps.

3

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.