Automated experiment execution on Android devices
This tool is only tested on Ubuntu, but it should work in other linux distributions. You'll need:
- Python 2.7
- Android Debug Bridge (
sudo apt install android-tools-adb
) - Android SDK Tools (
sudo apt install monkeyrunner
) - JDK 8 (NOT JDK 9) (
sudo apt install openjdk-8-jre
) - lxml (
sudo apt install python-lxml
)
Note: It is important that monkeyrunner shares the same adb the experiment is using. Otherwise, there will be an adb restart and output may be tainted by the notification.
Note 2: You can specifiy the path to ADB and/or Monkeyrunner in the experiment configuration. See the Experiment Configuration section below.
To run an experiment, run:
python android_runner your_config.json
There is an example configuration file in example/example_config.json
A JSON config that maps devices names to their ADB ids for easy reference in config files.
Below is a reference to the fields for the experiment configuration. It is not always updated.
adb_path string
Path to ADB. Example path: /opt/platform-tools/adb
monkeyrunner_path string
Path to Monkeyrunner. Example path: /opt/platform-tools/bin/monkeyrunner
type string
Type of the experiment. Can be web
or native
replications positive integer
Number of times an experiment is run.
devices Array<String>
The names of devices to use. They will be translated into ids defined in devices.json.
paths Array<String>
The paths to the APKs/URLs to test with.
browsers Array<String>
Dependent on type = web
The names of browser(s) to use. Currently supported values are chrome
.
profilers JSON
A JSON object to describe the profilers to be used and their arguments. Below is an example:
"profilers": {
"trepn": {
"sample_interval": 100
}
}
scripts JSON
A JSON list of types and paths of scripts to run. Below is an example:
"scripts": {
"before_experiment": "before_experiment.py",
"before_run": "before_run.py",
"interaction": "interaction.py",
"after_run": "after_run.py",
"after_experiment": "after_experiment.py"
}
Below are the supported types:
- before_experiment
executes once before the first run - before_run
executes before every run - interaction
executes between the start and end of a run - after_run
executes after a run completes - after_experiment
executes once after the last run
The original thesis can be found here:
https://drive.google.com/file/d/0B7Fel9yGl5-xc2lEWmNVYkU5d2c/view?usp=sharing
This happens when the user calling adb is not in the plugdev group.
sudo usermod -aG plugdev $LOGNAME
https://developer.android.com/studio/run/device.html
http://www.janosgyerik.com/adding-udev-rules-for-usb-debugging-android-devices/