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?
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.
Also refer to following commits:
Hope this helps.
@Vivek V Dwivedi Did you get a chance to try this ? Nov 9, 2015 at 1:28
I am working on it. Will update the results as soon as I can. Nov 10, 2015 at 10:30
Don't get your hopes up: github.com/appium/appium/pull/1890 Apr 11, 2016 at 21:56