A lightweight test input generator for Android. Similar to Monkey, but with more intelligence and cool features!
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.
DroidBot has the following advantages as compared with other input generators:
Li, Yuanchun, et al. "DroidBot: a lightweight UI-guided test input generator for Android." In Proceedings of the 39th International Conference on Software Engineering Companion (ICSE-C '17). Buenos Aires, Argentina, 2017.
Python(both 2 and 3 are supported)
platform_toolsdirectory in Android SDK to
OpenCV-Pythonif you want to run DroidBot in cv mode.
Clone this repo and intall with
git clone https://github.com/honeynet/droidbot.git cd droidbot/ pip install -e .
If successfully installed, you should be able to execute
+ `.apk` file path of the app you want to analyze. + A device or an emulator connected to your host machine via `adb`.
droidbot -a -o output_dir
That's it! You will find much useful information, including the UTG, generated in the output dir.
+ If you are using multiple devices, you may need to use `-d ` to specify the target device. The easiest way to determine a device's serial number is calling `adb devices`. + On some devices, you may need to manually turn on accessibility service for DroidBot (required by DroidBot to get current view hierarchy). + If you want to test a large scale of apps, you may want to add `-keep_env` option to avoid re-installing the test environment every time. + You can also use a json-format script to customize input for certain states. Here are some [script samples](script_samples/). Simply use `-script ` to use DroidBot with a script. + If your apps do not support getting views through Accessibility (e.g., most games based on Cocos2d, Unity3d), you may find `-cv` option helpful. + You can use `-humanoid` option to let DroidBot communicate with [Humanoid](https://github.com/yzygitzh/Humanoid) in order to generate human-like test inputs. + You may find other useful features in `droidbot -h`.