Large Language Models for Mobile GUI Text Input Generation: An Empirical Study

Chenhui Cui, Tao Li, Junjie Wang, Chunyang Chen, Dave Towey, Rubing HuangarXiv 2024 · DOI

Introduction: The Text Input Bottleneck

Automated mobile application testing is a cornerstone of modern software quality assurance. While current tools excel at navigating through buttons and menus, they frequently encounter a "wall" when faced with text input fields. Traditional automated testing tools often rely on "dummy" strings like "hello world," which are insufficient for fields requiring context-specific data such as valid email addresses, specific city names, or matching passwords. Failure to provide valid input prevents these tools from accessing deeper application logic, leaving significant portions of the code untested.

Figure 2: Mobile UI navigation often requires specific text inputs (e.g., start and destination locations) to proceed to subsequent pages.

This study explores the potential of Large Language Models (LLMs) to overcome this bottleneck by generating meaningful, context-aware text inputs based on an understanding of the user interface.

Methodology

The researchers developed a framework that treats text-input generation as a context-aware prompting task. The process follows a systematic workflow for analyzing the Application Under Test (AUT) and generating test cases.

Figure 6: The automated testing workflow involving the analysis of the AUT, construction of test cases, and execution within a testing environment.

The core approach involves four primary steps:

  1. Context Extraction: Using tools like UIAutomator, the system extracts component-level context (hint text, resource IDs), adjacent context (labels near the input field), and global context (app name and current activity).
  2. Prompt Construction: Two strategies were compared: concatenating context into natural language sentences versus providing the raw UI XML hierarchy.
  3. LLM Communication: Eight state-of-the-art models (including GPT-4o and Claude-Opus-4) were evaluated using iterative extraction to ensure outputs adhered to a strict JSON format.
  4. Criticality Evaluation: A new metric, the Criticality Score ($\Psi$), was introduced to measure a text field's importance in navigating to the next page.

Key Insights and Results

The empirical study yielded several significant findings regarding the effectiveness of LLMs in this domain:

  • Contextual Importance: Adjacent labels are critical. Removing context like a "Username" label located above a text box resulted in a 5% drop in success rates.
  • Efficiency vs. Detail: While XML provides more data, natural language prompts were found to be nearly as effective while being significantly more token-efficient and faster.
  • Performance Metrics: Claude-Opus-4 was identified as the top-performing model. Overall, LLMs achieved a Page Pass-Through Rate (PPTR) of over 70%.
  • Exploration Gains: Integrating LLM-generated inputs into the DroidBot testing tool increased UI page exploration by 36.06% and triggered 34.92% more activities compared to standard random testing.
  • The Bug Detection Gap: Despite their success in navigation, LLMs struggled with bug detection, identifying less than 24% of real-world bugs. They tend to generate valid inputs rather than the specific edge-case "invalid" inputs required to trigger deep logic flaws.

Discussion and Future Directions

While LLMs significantly enhance automated exploration, the current approach is largely static. Future research aims to develop Adaptive Random Testing, where models use real-time feedback (such as error messages) to refine their inputs. Additionally, expanding the scope to include complex components like Spinners and Multi-modal inputs (combining text with screenshots) could further bridge the gap between automated tools and human-like interaction.

This mini-paper is based on an empirical study investigating the role of LLMs in improving mobile GUI testing through context-aware text generation.

Summary updated

BibTeX
@misc{cui2024large,
  author = {Chenhui Cui and Tao Li and Junjie Wang and Chunyang Chen and Dave Towey and Rubing Huang},
  title = {{Large Language Models for Mobile GUI Text Input Generation: An Empirical Study}},
  year = {2024},
  eprint = {2404.08948},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2404.08948},
}
Figure