LLM-Guided Scenario-based GUI Testing

Shengcheng Yu, Yuchen Ling, Chunrong Fang, Quan Zhou, Chunyang Chen, Shaomin Zhu, Zhenyu ChenarXiv 2025 · DOI

Automated GUI testing for mobile applications has long been a cornerstone of software quality assurance. However, traditional tools often struggle with a "semantic gap"—they can trigger thousands of events to maximize code coverage but fail to understand the underlying business logic of the application. This paper introduces ScenGen, a multi-agent framework that leverages Large Language Models (LLMs) to automate scenario-based testing, mimicking the human "Observe-Orient-Decide-Act" (OODA) loop to complete complex, multi-step workflows.

The Challenges of Modern GUI Testing

Traditional automated testing approaches face three major hurdles that prevent them from effectively validating real-world usage:

  1. Lack of Intent: Random explorers do not understand why a user interacts with a button, leading to fragmented sequences that rarely complete a meaningful task, such as checking out a shopping cart.
  2. Hidden Functionalities: Modern minimalist designs often hide critical features behind non-obvious menus or floating icons. Without semantic understanding, automated tools rarely trigger these features.
  3. Brittle Scripts: Manual "record and replay" scripts are highly sensitive to UI changes; a minor layout update can render an entire test suite obsolete.
ScenGen addresses core challenges like hidden functions, domain knowledge requirements, and complex event sequences.

ScenGen argues for a scenario-based approach, where the fundamental unit of testing is a complete user task, such as "log in and send an email" or "configure a recurring alarm."

The ScenGen Framework

ScenGen orchestrates five specialized agents supported by a structured Context Memory to overcome the inherent statelessness of LLMs:

  • The Observer: Uses Computer Vision (CV) and OCR to interpret the semantic role of widgets, recognizing that a magnifying glass icon represents "Search" regardless of its underlying code label.
  • The Decider: Acts as the brain, taking the scenario goal and current UI state to plan the next logical action.
  • The Executor: Translates plans into executable system commands (e.g., Android ADB).
  • The Supervisor: Provides quality control by verifying if actions caused the intended state transitions and checking if the overall goal has been met.
  • The Recorder: Logs interactions into a tiered memory system (Long-term, Working, and Short-term) to maintain a coherent "train of thought."

A critical feature is the Self-Correction mechanism. If the Supervisor detects a failed action—such as a click that didn't trigger a new page—the Decider re-analyzes the failure and generates a corrected action, mimicking human persistence.

Key Insights and Innovations

ScenGen demonstrates that LLMs are superior to traditional heuristics as semantic interpreters. By understanding the context of an app, the system can infer that a floating "+" button is for "creating a note" even without explicit metadata. Furthermore, the framework integrates domain knowledge. For specialized apps like calculators, ScenGen uses the LLM’s internal logic to test mathematical edge cases, such as division by zero, which a random explorer would never intentionally seek out.

A complex 10-step registration scenario on the Zara app, demonstrating ScenGen's ability to handle intricate event generation.

Evaluation and Results

The authors evaluated ScenGen using a new benchmark consisting of 10 representative scenarios across 92 real-world apps from Google Play and Huawei AppGallery, totaling 99 specific tasks. ScenGen was compared against state-of-the-art baselines including GPTDroid, ScenTest, and ASOT.

  • Scenario Completion: ScenGen achieved an 86.87% Coverage Rate and an 84.85% Success Rate, significantly outperforming the next best competitor, ASOT (73.74% success).
  • Bug Detection: In head-to-head tests against traditional tools like Monkey and Stoat, ScenGen identified 106 unique bugs. Notably, 83% of these were confirmed or fixed by developers, highlighting their practical relevance.
  • Efficiency: Despite the computational overhead of LLMs, ScenGen averaged 4.71 minutes per scenario, making it faster than other LLM-based competitors like GPTDroid (7.48 min).

Conclusion and Future Work

ScenGen successfully bridges the semantic gap in GUI testing by treating app interaction as a goal-oriented reasoning task. While the system currently faces challenges with highly cluttered layouts and implicit data-saving logic, it represents a significant step toward autonomous, human-like software testing. Future work will focus on continual learning to improve agent performance over time and expanding support for multi-language interfaces.

Summary updated

BibTeX
@misc{yu2025llm,
  author = {Shengcheng Yu and Yuchen Ling and Chunrong Fang and Quan Zhou and Chunyang Chen and Shaomin Zhu and Zhenyu Chen},
  title = {{LLM-Guided Scenario-based GUI Testing}},
  year = {2025},
  eprint = {2506.05079},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2506.05079},
}
Figure