Ape: Automated Testing of Android Applications with Abstraction Refinement

Install

Files inside ape-bin.zip:

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

Just copy the ape.jar to the phone.

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

Evaluation

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.

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.

1
./ape.py -p com.google.android.calculator --running-minutes 100 --ape sata

Check the ape.py if you want to run Ape with an emulator. You should at least remove the -d options for adb.

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

Visualization

Note

Screenshot is disabled by default to save space.

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.