TL;DR
This paper introduces InputBlaster, a novel approach that leverages Large Language Models (LLMs) to automatically generate unusual text inputs for mobile app crash detection. By framing input generation as creating "test generators" guided by mutation rules, InputBlaster significantly outperforms existing methods, achieving a 78% bug detection rate and uncovering 37 new crashes in real-world applications.
What Problem Does This Paper Address?
Mobile applications are integral to our daily lives, and their reliability is paramount. A critical aspect of app quality is robust handling of user inputs, particularly text inputs, which are fundamental to user interaction. However, certain "unusual" or malformed text inputs, even those with subtle differences from valid inputs, can trigger application crashes. Manually generating a comprehensive set of such unusual inputs for thorough testing is a monumental task due to the sheer variety of input formats, context sensitivity, and complex inter-widget constraints. Existing automated testing approaches often focus on generating valid inputs or have limitations in capturing the nuanced nature of unusual inputs that lead to crashes. This paper addresses the challenge of automatically generating diverse and effective unusual text inputs to uncover these critical crash bugs.
Methods
The core of InputBlaster lies in its innovative use of LLMs to generate "test generators" rather than directly producing unusual inputs. This approach is broken down into three main modules:
- Prompt Generation for Valid Input: This module uses LLMs to first generate valid text inputs that can successfully navigate the app's GUI. It leverages context from the view hierarchy, dynamic hints (feedback from the app on incorrect inputs), and pre-defined constraint categories to guide the LLM.
- Prompt Generation for Test Generator with Mutation Rule: Building on the valid inputs, this module prompts the LLM to generate both a "mutation rule" (a natural language description of how to alter the valid input) and a "test generator" (a code snippet) that can produce a batch of unusual inputs based on that rule. This formulation allows for efficient generation of multiple test cases from a single LLM interaction.
- Enriching Prompt with Examples: To further boost LLM performance, this module employs in-context learning. It constructs an example dataset of known buggy inputs from GitHub and ongoing testing, and uses a retrieval-based method to select the most relevant examples to include in the LLM's prompt.
Datasets
The paper utilizes several datasets:
- Motivational Study Dataset: 2000 apps with text inputs were manually categorized to derive constraint types.
- Example Dataset: Buggy text inputs were collected from GitHub issue reports (prior to September 2022) and augmented with newly discovered bugs during InputBlaster's testing. This dataset contains buggy inputs, their associated mutation rules (if known), and context information.
- Evaluation Dataset: 31 popular Android apps with 36 known text input-related crash bugs were used for evaluating InputBlaster's effectiveness. These apps were sourced from F-Droid and were not part of the motivational study or example dataset construction.
Key Insights and Ideas
- Framing Input Generation as "Test Generators": The key innovation is shifting from direct unusual input generation to generating "test generators" guided by mutation rules. This significantly improves efficiency by allowing a single LLM prompt to yield a batch of test cases.
- LLMs as "Mutation Rule" Creators: LLMs are not just used to generate inputs but also to define the logic (mutation rules) for creating those inputs, acting as a reasoning chain for effective bug triggering.
- In-Context Learning is Crucial: The effectiveness of the LLM is significantly enhanced by providing relevant examples of buggy inputs and their context, demonstrating the power of in-context learning for domain-specific tasks.
- Context is King for Unusual Inputs: The success of InputBlaster hinges on its ability to extract and utilize rich context from the app's UI (view hierarchy, dynamic hints) to generate inputs that are semantically relevant to the input widget and its constraints.
Key Results
- High Bug Detection Rate: InputBlaster achieved a 78% bug detection rate (28 out of 36 known bugs) within 30 minutes, with an average of 13.52 attempts.
- Superior Performance: Compared to 18 baselines, InputBlaster demonstrated a 136% higher bug detection rate than the best baseline (TextExerciser).
- Uncovering New Bugs: When integrated with an automated GUI testing tool (Ape), InputBlaster helped detect 37 new, previously unseen crash bugs in real-world apps from Google Play. Of these, 28 have been confirmed or fixed by developers.
- Module Contributions: Ablation studies showed that each module of InputBlaster contributes significantly, with the "valid input generation" module having the largest impact on performance. Removing mutation rules also severely degraded performance.
Limitations and Future Work
- Representativeness of Apps: The experimental apps were selected from popular and active sources, but a broader selection could further enhance generalizability.
- Focus on Crash Bugs: The study exclusively focused on crash bugs, which are automatically observable. Future work could explore other types of bugs.
- LLM Uncertainty: LLM outputs can be unpredictable. The paper acknowledges this and mentions the use of in-context learning and feedback mechanisms to mitigate it.
- Testing Order Influence: The performance can be influenced by the order in which apps are tested due to the dynamic nature of the example dataset.
- Future Directions: The authors plan to analyze the root causes of input-related bugs and develop automated bug repair strategies. They also aim to conduct more thorough experiments across different platforms (iOS, Web) and explore the patterns of these bugs for potential repair methods.
Summary updated