Abstract
The rapid expansion of the mobile Internet has made mobile application (app) quality assurance increasingly critical. While automated test generation approaches have become a dominant strategy, they primarily focus on optimizing code coverage through specific models or random exploration. This creates a significant gap between automated execution and actual app business logic. Human testers, conversely, organize test scripts based on functional scenarios and GUI understanding. This paper introduces ScenTest, a novel framework that utilizes domain knowledge from app GUI understanding to automate scenario-based testing. By constructing an Event Knowledge Graph (EKG) from crowdsourced test reports, ScenTest mimics human practices to navigate complex workflows. Our evaluation demonstrates that ScenTest effectively generates tests across diverse apps and scenarios, uncovering over 150 distinct real-world bugs that traditional baselines failed to detect.
Introduction
Automated mobile app testing typically relies on two methodologies: random exploration (e.g., Google’s "Monkey") or model-based approaches. While these methods are efficient at maximizing code coverage, they often lack an understanding of high-level business logic. For instance, a random tester might interact with every element on a screen but fail to complete a "Checkout" sequence because it does not understand the prerequisite steps, such as entering a shipping address. This "Mobile App Testing Dilemma" highlights the need for tools that can execute functional scenarios across unseen applications by understanding the semantic meaning of the GUI.
The ScenTest Framework
ScenTest bridges the gap between human-centric scenario testing and automated tools through a two-stage process: EKG construction and guided testing.
1. Event Knowledge Graph (EKG) Construction
To capture domain knowledge, ScenTest processes 22,720 crowdsourced test reports containing screenshots and natural language descriptions. The construction involves:
- Image Understanding: Utilizing Canny edge detection and Convolutional Neural Networks (CNNs), the system identifies UI widgets (e.g., buttons, text fields) and classifies their types.
- Text Understanding: Using NLP libraries like Jieba and DDParser, ScenTest extracts reproduction steps from text, identifying specific operations such as "click" or "input."
- Coreference Resolution: To create a unified graph, the framework merges similar entities. For example, it recognizes that "Sign In" and "Login" represent the same semantic action, allowing it to build a generalized flow for specific scenarios like "Add to Cart."
2. Guided Test Generation
During the testing of a new, unseen app, ScenTest captures the current screen and queries the EKG. It calculates the probability of the next optimal action based on the "testing context"—the sequence of events already performed. This allows the tool to "explore with a purpose," navigating through sub-scenarios (such as different login methods like Email vs. OAuth) using a depth-first strategy.
Experimental Evaluation
We evaluated ScenTest using a knowledge source of over 22,000 reports across 70 apps. The evaluation set included 124 mobile apps covering eight common functional scenarios: Login, Register, Email, Flight Ticket, Add to Cart, Chat, Music, and Video. ScenTest was compared against industry standards, including Monkey (random), Stoat (model-based), and UniRLTest (reinforcement learning).
Key Findings
- Bug Discovery: ScenTest successfully identified 150+ distinct real-world bugs. In many of these scenarios, traditional baselines like Monkey and Stoat found fewer than 10 bugs, as they could not navigate the required functional logic.
- Prediction Accuracy: The EKG-guided approach achieved a 94.69% success rate in predicting the correct widget to operate, demonstrating that functional logic is highly consistent across different app designs.
- Efficiency: ScenTest completed full scenario-based tests in an average of 378 seconds, making it a practical solution for rapid development cycles.
- Extraction Reliability: The automated NLP pipeline reached a precision of 96.98% in extracting entities from human-written reports.
Discussion and Limitations
ScenTest demonstrates that UI patterns are generalizable; a "Login" flow in a shopping app is semantically similar to one in a social media app. By extracting this domain knowledge into a graph, the tool can effectively test apps it has never encountered before.
However, several challenges remain. System-level interruptions (e.g., incoming calls) and network latency can disrupt automated flows. Additionally, ScenTest currently struggles with non-robot verifications like CAPTCHAs and complex multi-factor authentication. Future work will focus on handling third-party transitions (e.g., jumping to a browser for PayPal authorization) and expanding cross-app logic for multi-app workflows.
Conclusion
ScenTest represents a significant step toward fully automated, scenario-based mobile app testing. By integrating computer vision and NLP to build an Event Knowledge Graph, it moves beyond simple code coverage to ensure that the core business logic of an application functions as intended for the end user.
Summary updated