Ape: Automated Testing of Android Applications with Abstraction Refinement

Download

Publication

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.

Evaluation

In the ICSE paper, we evaluated Ape in two experiments.

Mini Tracing

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.

Install

Files inside ape-bin.zip:

1
2
3
4
5
6
ape-bin/
ape-bin/ape
ape-bin/ape.jar
ape-bin/ape.py
ape-bin/install.py
ape-bin/README.md

Copy Just copy the ape.jar to the phone.

1
adb push ape.jar /data/local/tmp/

and run

1
adb shell CLASSPATH=/data/local/tmp/ape.jar /system/bin/app_process /data/local/tmp/ com.android.commands.monkey.Monkey

More details can be found in README.md.

Run

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
./ape.py -p com.google.android.calculator --running-minutes 100 --ape sata

Check the ape.py if you want to run Ape with multiple devices via adb -s.

Options:

You can also specify the total amount of Monkey events. In this mode, Ape will stop by default once there is a crash.

1
./ape.py -p com.google.android.calculator --ape sata 1000

Output

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.

Visualization

We provide a tool to visualize the model.

  1. Ape writes several js files into the output folder for visualization.
    • Check the tail of the output message to locate the output folder in the phone.
  2. adb pull /sdcard/your-output-folder to your local directory.
  3. Copy the following files into the local output directory
  4. Open the copied vis.html in your browser.
    • You may need to wait for a certain amount of time to let the browser render the model.

Examples:

Now we can check the timeline.

Acknowledgments

We thank the following experts for their insightful comments on Ape.