Enhancing GUI Exploration Coverage of Android Apps with Deep Link-Integrated Monkey

Han Hu, Han Wang, Ruiqi Dong, Xiao Chen, Chunyang Chen

Abstract

Automated GUI testing for Android applications frequently encounters the "exploration loop" problem, where testing tools become trapped in a subset of the user interface, failing to reach deep-stack activities. This paper presents Delm (Deep Link-enhanced Monkey), a novel framework that leverages Android’s deep link mechanism to bypass navigation barriers. By combining static analysis with automated context mocking, Delm enables "teleportation" to hard-to-reach app components while maintaining system stability. Experimental results across diverse datasets, including 68 industrial applications, demonstrate that Delm significantly outperforms state-of-the-art tools in both code coverage and crash detection.

1. Introduction

The complexity of modern Android applications poses a significant challenge for automated GUI testing. Traditional tools, such as Google’s Monkey, rely on pseudo-random event streams (e.g., taps, swipes) to explore the application state space. While effective for surface-level testing, these "random-walk" approaches often fail to penetrate "deep-stack" activities—pages buried under multiple layers of navigation or requiring specific interaction sequences.

A potential solution lies in "deep links," which are URIs that direct users to specific components within an app. However, utilizing deep links for automated testing is non-trivial. Directly jumping to an activity often triggers "false positive" crashes because the target component expects specific state data (Intents) that the tester has not initialized. This paper introduces Delm, a framework designed to navigate these challenges through intelligent deep link integration and data-driven context mocking.

2. The Delm Framework

Delm enhances standard random-walk testing through a three-stage pipeline:

2.1 Static Analysis and ATG Construction

Delm begins by analyzing the application's bytecode or source code to construct an Activity Transition Graph (ATG). This graph maps the possible paths between different UI components. Crucially, Delm identifies existing deep links and, where necessary, "injects" new ones into the application manifest. This process ensures that every activity within the app is theoretically accessible via an external URI.

2.2 Context Mock-up via Dataflow Analysis

To address the issue of crashes during direct navigation, Delm employs dataflow analysis to identify the "Intent" requirements of each activity. By tracing definition-use chains, the framework determines which data types (e.g., strings, integers, booleans) an activity expects upon launch. Delm then generates "mock" data to satisfy these requirements, allowing the activity to initialize successfully without the prerequisite manual navigation.

2.3 Guided Exploration

During the testing phase, Delm monitors the exploration progress in real-time. If the tester is detected to be in an exploration loop or fails to discover new activities within a set timeframe, Delm intervenes. It consults the ATG to identify unexplored nodes and uses a deep link combined with the mocked context to "teleport" the tester directly to the target activity. This hybrid approach allows the tool to benefit from the speed of random testing while using deep links to overcome navigation bottlenecks.

3. Experimental Evaluation

The researchers evaluated Delm using four distinct datasets to ensure a comprehensive assessment of its capabilities:

  • IntentBench: A benchmark specifically designed to test how well tools handle complex inter-component communication.
  • IndustrialApps: A collection of 68 top-rated, closed-source apps from Google Play (e.g., WhatsApp, Spotify, Alltrails) to test real-world performance.
  • Themis: A dataset of 20 open-source apps with 52 known, reproducible crash bugs used to measure crash detection accuracy and false positives.
  • AndroTest: A standard dataset for evaluating method-level code coverage.

4. Results

Delm demonstrated a clear advantage over state-of-the-art baselines, including Monkey, Fastbot, and Fax:

  • Activity Coverage: Delm reached 27.2% of app activities on average, outperforming the best baseline by over 41%.
  • Method Coverage: The framework achieved 21.13% coverage, an 11.39% improvement over the best baseline.
  • Crash Detection: Delm successfully identified 78 unique crashes. In the Themis benchmark, it detected 28 true crashes with zero false positives, whereas competing tools like Fax triggered several false alarms due to poor context handling.
  • Efficiency: In complex apps like Amazon Prime Video, Delm was able to reach pages that traditional tools missed entirely because they were buried too deep in the UI.

5. Conclusion and Future Work

Delm demonstrates that deep links can serve as a powerful architectural "backdoor" for automated testing when coupled with rigorous context mocking. By treating deep links as testing primitives, Delm effectively solves the exploration loop problem, allowing for deeper and more stable app analysis.

The authors acknowledge current hurdles, such as the difficulty of automatically generating complex, custom Java objects (Serializable/Parcelable) and the challenges of analyzing decompiled "smali" code when source code is unavailable. Future work will focus on incorporating computer vision to help the tool understand UI changes more intuitively, potentially reducing the reliance on low-level system metadata.

Summary updated

BibTeX
@article{hu2024enhancing,
  author = {Han Hu and Han Wang and Ruiqi Dong and Xiao Chen and Chunyang Chen},
  title = {{Enhancing GUI Exploration Coverage of Android Apps with Deep Link-Integrated Monkey}},
  journal = {ACM Trans. Softw. Eng. Methodol.},
  year = {2024},
  doi = {10.1145/3664810},
}
Figure