Make LLM a Testing Expert: Bringing Human-like Interaction to Mobile GUI Testing via Functionality-aware Decisions

Zhe Liu, Chunyang Chen, Junjie Wang, Mengzhuo Chen, Boyu Wu, Xing Che, Dandan Wang, Qing Wang

TL;DR

GPTDroid transforms mobile GUI testing from a brute-force search into a conversational Q&A task. By leveraging Large Language Models (LLMs) and a novel "functionality-aware memory" mechanism, it mimics human intuition to navigate complex apps, achieving 32% higher activity coverage and detecting significantly more bugs than state-of-the-art automated tools.

What Problem Does This Paper Address?

Automated Graphical User Interface (GUI) testing is essential for mobile app quality, but it’s notoriously difficult. Traditional methods—ranging from random "monkey" testing to sophisticated Reinforcement Learning (RL)—often fall into two traps:

  1. The Local Dilemma: Tools get stuck in a loop within a single part of the app (like a settings menu) because they lack a "global" understanding of where they have already been.
  2. The Low-Level Dilemma: Most tools focus on individual widgets (buttons, text boxes) without understanding the high-level "business logic" or functionality (e.g., "I am currently trying to add a bank account").

Furthermore, existing learning-based tools require massive amounts of training data and often fail to generate the valid, context-specific text inputs (like names or dates) required to move past a login or registration screen.

Methods

The authors propose GPTDroid, a framework that treats the app as a "chat partner" for an LLM (specifically GPT-3.5).

The Core Loop

  1. GUI Context Extraction: The tool decompiles the app to extract semantic information, including activity names, widget text, resource IDs, and relative positions.
  2. Linguistic Prompting: This raw data is converted into natural language descriptions (e.g., "The current page is 'Main', it has 'Income' and 'Add' buttons...").
  3. Functionality-aware Memory Prompting: This is the paper's primary innovation. GPTDroid maintains a "Testing Sequence Memorizer" that tracks explored activities and widgets. Crucially, it asks the LLM to identify the current functionality under test. This forces the LLM to reason about its long-term goals and prioritize unexplored features.
  4. Executive Command Generation: The LLM outputs a command (e.g., click "Add Income"), which GPTDroid executes. The app's feedback (success, failure, or a new screen) is fed back into the next prompt.

Datasets

The researchers evaluated GPTDroid using two primary sources:

  • Themis Benchmark: 20 open-source apps containing 34 known bugs.
  • Google Play Dataset: 73 popular apps with 109 confirmed bugs used to measure coverage and detection rates.
  • Real-world "Wild" Testing: To test usefulness, they ran the tool on 223 additional apps from Google Play to find previously undiscovered crashes.

Key Insights and Ideas

  • LLMs as Semantic Experts: Unlike traditional tools that see a button as a coordinate, an LLM understands that a button labeled "Submit" is likely the end of a sequence. This allows for "human-like" navigation.
  • Context is King: The paper demonstrates that providing the LLM with a "global view" (via the memory prompt) prevents it from getting stuck in local loops. When the LLM knows it has already visited the "Settings" page five times, it naturally chooses a different path.
  • Valid Text Input: One of the biggest hurdles in automated testing is filling out forms. GPTDroid can generate semantically correct inputs (e.g., entering a numeric value for "Price" and a string for "Title") that allow it to reach deeper app layers that random testers never see.

Key Results

GPTDroid significantly outperformed 10 state-of-the-art baselines (including Monkey, Stoat, and Ape):

  • Coverage: It achieved 75% activity coverage and 66% code coverage, representing a 32% boost over the best-performing baseline.
  • Bug Detection: It detected 31% more bugs than the best baseline and reached its peak detection count much faster (around 27 minutes vs. 60 minutes for others).
  • Real-World Impact: In the "wild" test of 223 apps, GPTDroid identified 53 new bugs on Google Play. At the time of publication, 35 of these had already been confirmed and fixed by developers.

Limitations and Future Work

While powerful, GPTDroid has a few notable limitations:

  • Widget Dependency: If an app is poorly designed and its widgets lack descriptive text or IDs, the LLM’s "vision" is blurred, leading to poorer performance.
  • Action Variety: The current implementation focuses on standard actions (click, scroll, long press, input). It does not yet handle complex custom gestures like multi-touch or drag-and-drop.
  • Cost and Latency: Relying on LLM APIs introduces costs and network latency that local, heuristic-based tools do not have.

The authors suggest that future work could involve fine-tuning open-source LLMs specifically for GUI testing to reduce costs and improve domain-specific performance.

Summary updated

BibTeX
@inproceedings{liu2024make,
  author = {Zhe Liu and Chunyang Chen and Junjie Wang and Mengzhuo Chen and Boyu Wu and Xing Che and Dandan Wang and Qing Wang},
  title = {{Make LLM a Testing Expert: Bringing Human-like Interaction to Mobile GUI Testing via Functionality-aware Decisions}},
  booktitle = {ICSE},
  year = {2024},
  doi = {10.1145/3597503.3639180},
}
Figure