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
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.
-
-
I am working on it. Will update the results as soon as I can. Commented Nov 10, 2015 at 10:30
-
Don't get your hopes up: github.com/appium/appium/pull/1890 Commented Apr 11, 2016 at 21:56