Hello,
I’m using Appium + Cucumber to run end-to-end tests for a React Native app on Android.
I would like to quantify the achieved code coverage but don’t seem to find any resources on the web for this tool combination.
While I know how to instrument the code with Istanbul, and do see the resulting global __coverage__
object in the remote debugger, I don’t find a good way of retrieving that object at the end of the tests.
I found the documentation and some posts on this forum about switching between the native and webview context [1], [2] and hope that this would allow me (together with a call to execute) to retrieve the coverage results.
But I cannot find a sample for how to get (or set up) a reference to the driver
instance. I created a wdio service and tried something like
const driver = AppiumDriver.driverForSession(browser.sessionId);
but the result is undefined.
Can someone please point me into the right direction?
Thank you
Kambiz
[1] https://appium.io/docs/en/commands/context/set-context/
[2] How to Switch between webContext and native context before the method