Using the built-in code coverage tool in IntelliJ on an .apk file

Answered
 

I want to run a coverage analysis of an app (komoot) that I am testing using Appium. This app is already running, I downloaded it to perform experimental testing. I downloaded the app from F-Droid and have the source code handy. I have written the test in IntelliJ and use an android phone emulator to simulate the actions of the test on the app. 

I'm confused about how I would use the built-in code coverage tool to instrument the .apk file in order to see how much of the .apk source code is executed by my test. As of now, I run my test in IntelliJ using the "Run with coverage" option (using IntelliJ's own coverage collection) but the coverage window displays "no coverage" after the test successfully runs.

I would appreciate suggestions for how to do this! For reference, here is a screenshot of my project directory: the app source code is in the "komootDemo/apps" titled "komoot.apk" and my test is in the "komootDemo/src/test/java/scenarios" folder titled "AndroidSetup." Am I getting no coverage back from my test because the source code is in a separate folder? 

1 comment
Comment actions Permalink

Hi,

 

builtin coverage works over byte code as class instrumentation. As far as i understand apk files can't be supported in this setup and run with coverage could show the coverage for your test classes only. 

 

Anna

0

Please sign in to leave a comment.