TimeMachine is an automated testing tool for Android apps, which can automatically jump to the most progressive state observed in the past when progress is slow.
TimeMachine leverages virtualization technology such as emulator to save an app state and restore it when needed. TimeMachine identifies an app state with GUI layout and memories all discovered states. When a state is considered interesting, e.g., new code is covered, TimeMachine saves the state. Meanwhile, TimeMachine observes most-recently-visited states to check whether progress is slow, e.g., being stuck in a state loop. Once progress is considered slow, TimeMachine restores the most progressive one from saved states for further exploration so that more program behavior is exercised in a short time.
@InProceedings{zhendong:icse:2020,
author = {Zhen Dong, Marcel B\"ohme, Lucia Cojocaru, Abhik Roychoudhury},
titile = {Time-travel Testing of Android Apps},
booktitle = {Proceedings of the 42nd International Conference on Software Engineering},
series = {ICSE '20},
year = {2020}
}
The figure above shows TimeMachine's architecture. The whole system runs in a docker container with the Ubuntu operating system. App under test is installed in an Android virtual machine. TimeMachine connects the virtual machine via ADB to test the app. Main Components are configured as followed:
- Android SDK Version 25
- Android-x86-7.1.r2
- Virtualbox v5.0.18
- Docker API v1.13 or above
- Python 2.7.2
- To build a component to dynamically load virtualbox-dkms from a container
- Installations of virtualbox and linux-header can be avoided on the host machine,
- Only docker installation is needed on the host machine.
The following is required to set up TimeMachine:
- at least 100 GB hard drive
- 8 GB memory
- Ububntu 16.04 64-bit
git clone https://github.com/DroidTest/TimeMachine.git
install a specific version of linux header (using linux-headers-4.4.0-124-generic)
sudo apt-get install linux-headers-generic
install virtualbox 5.0.18
sudo apt-get install virtualbox-dkms=5.0.18-dfsg-2ubuntu1
sudo apt-get install virtualbox=5.0.18-dfsg-2build1
sudo apt-get install virtualbox-qt=5.0.18-dfsg-2build1
install and configure docker
sudo apt-get install docker.io
sudo groupadd docker
sudo usermod -aG docker $USER
newgrp docker
install aapt
sudo apt install aapt
./build_docker_image.bash
It takes around 20 minutes.
cd fuzzingandroid
Test example apps in a container
./exec-single-app.bash ../two_apps_under_test/ms_word/ 21600 ../word_output
./exec-single-app.bash ../two_apps_under_test/duolingo/ 21600 ../duolingo_output
check method coverage
./compute_cov_aver.bash ../word_output/ ../two_apps_under_test/ms_word/
./compute_cov_aver.bash ../duolingo_output/ ../two_apps_under_test/duolingo/
check crashes
cat word_output/hypermonkey-output/pareto_crash.log
cat duolingo_output/hypermonkey-output/pareto_crash.log
- If failed to connect VM, please check whether the version of installed linux-header is 4.4.0-124-generic
- Contact Zhen Dong for further issues.
- Zhen Dong (zhendng@gmail.com)
- Lucia Cojocaru
- Xiao Liang Yu
- Marcel Böhme
- Abhik Roychoudhury