DroidTest / TimeMachine

Time-travel Testing
https://www.comp.nus.edu.sg/~abhik/pdf/ICSE20TM.pdf
GNU Lesser General Public License v3.0
106 stars 26 forks source link

No Coverage for Android apps implementing Dynamic Delivery #7

Open negarq opened 4 years ago

negarq commented 4 years ago

I am trying to run TimeMachine to test an Android app. I am doing every step exactly as instructed in in this repo. I was able to run it with the apps in "two_apps_under_test" directory, and the results showed thousands of methods for method coverage. However, I have a problem running it on some other apps not included in your repo. When I try to run TimeMachine on my own apps, it seems to run with no error for about 30 minutes, but at the end the coverage result is 0. These apps are in forms of closed-source base APKs that use Android dynamic delivery in their implementation. In other words, the base.apk is part of an app bundle that includes dynamic feature modules and using the Play Core API (SplitInstallManager) the base APK request to install the dynamic features on-demand.

I was wondering if TimeMachine is capable of supporting app bundles with dynamic feature modules. If yes, could you please help me with the result I get?

You can find the apk, and the output result of running TimeMachine on it here.

zhendong2050 commented 4 years ago

Hi Negar,

As mentioned in the paper, TimeMachine uses a modified version of Ella for saving coverage data in /sdcard on the Android framework. So you need to modify the original Ella to save data coverage in /sdcard, or use the version I modified. Ella files I changed are shared in the Github issue. please reference this issue: https://github.com/DroidTest/TimeMachine/issues/6

Old AOSP versions(Android4.4) have Google service apps but new versions of AOSP (Android 7) do not have any more. What you can do is: 1) manually install Google service apps in the emulator and save a snapshot of the emulator (reference https://opengapps.org/ for Google apps installation) 2) Use the saved snapshot as the VM image

Can you kindly create a new issue on the Github and move the question there? So the answer also can help others. Thanks.

Best regards Zhen

negarq commented 4 years ago

Thanks for your response. I instrumented my app with the modified version of Ella. I also created a VM image of an Android 10 emulator. Could you elaborate more on where and how I should put it to override the /AndroidOS/Android7 version you already have for the emulator? I saved my Android10 as Android10.vmdk file in /root/AndroidOS directory of the docker, and I modified the VM=${5:-'Android7_1'} value in start.bash to Android10 (the name of my image). I also modified ORIGINAL_DISK path in the setup_vm.sh to: ORIGINAL_DISK=$DISK_PATH/Android10.vmdk

These are all the places I thought I should modify, but still the coverage is zero. Could you please let me know what is going wrong?

zhendong2050 commented 4 years ago

Can you please check if coverage data is stored in folder /sdcard? Maybe you test this on a standard emulator and make sure coverage data is generated by Ella and stored /sdcard.

negarq commented 4 years ago

My problem right now is in the VM image of the emulator. I need to use an emulator with Android 10 and Google services, but the image in TimeTravel docker is Android 7. So even if I manually install Google services on it, I can't use Android 7. The only way I can build such emulator is in Android Studio (AVD Manager). Could you please help me with building such VM which can be stored and used in the docker?

zhendong2050 commented 4 years ago

Emulators in Android studio can be an option since they support saving&restoring states. This is planed.

negarq commented 2 years ago

I understand that Android Studio can do that. However, I don't want to solely use Android Studio. I want to be able to integrate the VM image of such emulator, with Android 10 and google services that support Android dynamic delivery, with time-travel testing through the docker image you provided.