Instrument an Android app to measure the test coverage.
Take method coverage as an example, the steps to measure the method coverage of dyn. analysis are as follows:
- Analyze the app and get a list of all methods in the app.
- Instrument the app to print log messages when it reaches a method.
- Run the app and collect the log messages.
- Get the list of reached methods.
- Calculate the coverage (i.e. the percentage of reached methods).
mvn package
java -jar androcov.jar -o <directory> -i <APK> [-h] -sdk <android.jar>
-o,--output <directory> path to output dir
-i,--input <APK> path to target APK
-h,--help print this help message
-sdk,--android_jar <android.jar> path to android.jar