Ape applies a CEGAR style technique to refine and coarsen the model abstraction. A paper about Ape's main idea has been accepted to ICSE 2019.
Slides:
In the ICSE paper, we evaluated Ape in two experiments.
com.citymapper.app.release
com.duolingo
com.enzuredigital.weatherbomb
com.google.android.apps.docs
com.google.android.apps.translate
com.nuzzel.android
com.popularapp.thirtydayfitnesschallenge
com.zillow.android.zillowmap
flipboard.app
org.videolan.vlc
tunein.player
com.amaze.filemanager
com.eleybourn.bookcatalogue
org.liberty.android.fantastischmemo
org.totschnig.myexpenses
SERIAL
and ANDROID_HOME
.We provided a libart.so
for x86 emulators to collect coverage without instrumentation.
That means, you can use this tool to collect coverage for apps such as Google Doc to evaluate your tools.
Note
To install and use MiniTracing, an emulator must be started with option -writable-system
.
No product build emulators such as those with builtin Google Play Store are supported.
See Install the Google Play Store in an Emulator manually.
x86_arm
emulator.Files inside ape-bin.zip
:
1 2 3 4 5 6 |
|
Copy Just copy the ape.jar
to the phone.
1 |
|
and run
1 |
|
More details can be found in README.md
.
We provide a python script (i.e., ape.py
) to facilitate running ape on Android platform.
The following command starts to run Ape to test the Calculator on a real device connected via adb
.
Make sure adb
is available in your PATH
.
1 |
|
Check the ape.py
if you want to run Ape with multiple devices via adb -s
.
Options:
-p
: specify the package name, the same as Monkey--running-minutes
: the total testing time in minutes--ape sata
: use the default exploration strategy described in the paper.random
and sata
are supported now, where sata
is the default exploration strategy described in the paper.You can also specify the total amount of Monkey events. In this mode, Ape will stop by default once there is a crash.
1 |
|
Users should save everything that has been outputted into the console.
In addition to the standard output, Ape also records both high-level actions and low-level events and saves them into a folder under /sdcard
,
e.g., /sdcard/sata-com.amaze.filemanager-ape-sata-running-minutes-10
.
action-history.log
: The history of actions. We create a phantom action PHANTOM_CRASH
to record crash information.
An action may produce more than one events.produce.log
: The history of events that are generated from actions.consume.log
: The history of events that are actually injected but the injection may fail. For example, a click event may fail if the GUI changes after the event is created.sataGraph.vis.js
: Model graph can be visualized using vis.sataTimeline.vis.js
: Timeline can be visualized using vis.sataModel.obj
: Model graph has been dumped using the Java Serialization API. This file could be used for off-line graph analysis of the model.step-11-g5s8.txt
: The state at iteration 11.step-1404.xml
: The GUI tree (in XML) at iteration 1404.step-597.png
: The snapshot at step 597.We provide a tool to visualize the model.
adb pull /sdcard/your-output-folder
to your local directory.vis.html
in your browser.Examples:
Now we can check the timeline.
vis-timeline.html
in your browser.Ape will read file /sdcard/ape.xpath
to patch the GUI tree before applying the abstraction function to build the state.
The configuration file is a JSON file encoding a JSON array. Each element of the array is an object that has the following attributes.
"xpath"
: the xpath to select elements in the XML treeuiautomator dump --compressed
. Please check the output directory to find some examples (e.g., step-N.xml
)text
has been truncated to save memory. Try to avoid using property text
or see ape.truncateTextLength
. The default length of truncated text string is 8."actions"
(optional): a set of supported model actions, i.e., MODEL_CLICK
, MODEL_
MODEL_CLICK
MODEL_LONG_CLICK
MODEL_SCROLL_TOP_DOWN
or MODEL_SCROLL_BOTTOM_UP
MODEL_SCROLL_LEFT_RIGHT
or MODEL_SCROLL_RIGHT_LEFT
"text"
(optional):EditText
, the text will be used to generate input for the widget."throttle"
(optional):1 2 3 4 5 6 7 8 9 10 |
|
The above example will do the following patch to every GUI tree.
San Francisco
for every EditText
.ImageButton
(no actions).Ape will output the following messages if it can successfully parse file ape.xpath
.
1 2 |
|
Note
ape.xpath
is a valid JSON file and still available at /sdcard/ape.xpath
.step-N.xml
.We thank the following experts for their insightful comments on Ape.