DroidBot is a lightweight test input generator for Android. It can send random or scripted input events to an Android app, achieve higher test coverage more quickly, and generate a UI transition graph (UTG) after testing. A sample UTG is shown here.
It has the following advantages as compared with other input generators:
- It does not require system modification or app instrumentation;
- Events are based on a GUI model (instead of random);
- It is programmable (can customize input for certain UI);
- It can produce UI structures and method traces for analysis.
Reference
Python
version2.7
Java
version1.7
Android SDK
- Add
platform_tools
directory andtools
directory in Android SDK toPATH
Clone this repo and intall with pip
:
git clone https://github.com/honeynet/droidbot.git
pip install -e droidbot
If successfully installed, you should be able to execute droidbot -h
.
-
Make sure you have:
.apk
file path of the app you want to analyze.- A device or an emulator connected to your host machine via
adb
. - Get the serial number (e.g.
emulator-5554
) of target device usingadb devices
.
-
Start DroidBot:
droidbot -d <serial> -a <path_to_apk> -policy dfs
DroidBot uses an app model to generate test input. Currently, DroidBot support following three strategies:
- random -- Generate random input events;
- dfs/bfs -- Explore the UI states using a depth-first/breadth-first strategy;
- script -- Use a script to customize input for certain states. HOW.
We have conducted several experiments to evaluate DroidBot by testing apps with DroidBot and Monkey. The results can be found at DroidBot Posts. A sample evaluation report can be found here.