Introduction
Graphical User Interface (GUI) testing is a critical yet labor-intensive component of mobile application development. While automated test generation tools exist, they often struggle with complex user flows. An alternative approach is test reuse, which involves migrating existing test scripts from a source application to a functionally similar target application (e.g., transferring a test from one To-Do list app to another).
However, traditional test reuse methods frequently fail due to semantic mismatches (different widget labels), layout variations, and functional redundancies. To address these challenges, this paper introduces TRASM (Test Reuse based on Adaptive Semantic Matching), a framework designed to improve the precision and efficiency of cross-app test migration.
The TRASM Framework
TRASM improves upon existing state-of-the-art tools like CRAFTDROID by introducing two primary innovations: GUI event deduplication and an adaptive matching strategy.
GUI Event Deduplication
One common cause of test failure is the presence of "meaningless" events in the source test that do not exist in the target app, such as a tutorial or welcome screen. TRASM identifies and removes these redundant events before execution, ensuring the test flow remains uninterrupted and aligned with the target app's specific UI structure.
Adaptive Semantic Matching
Unlike "greedy" matching algorithms that simply select the most visually similar widget at any given step, TRASM employs an adaptive strategy. It utilizes a Window Transition Graph (WTG)—a map of the application's screens and interactive elements—to ensure reachability. If a chosen test path fails, TRASM can backtrack and "rematch" events with alternative candidates that are functionally viable within the current app state. Similarity is calculated using Word2Vec models, allowing the system to understand that terms like "task" and "todo" are semantically equivalent.
Evaluation and Results
The researchers evaluated TRASM using a benchmark of 15 Android applications across three categories: Browsers, Tip Calculators, and To-Do Lists. The framework was tested against 30 test cases covering six core functionalities.
Key findings include:
- Improved Precision: TRASM increased GUI event matching precision by 5% to 15% compared to CRAFTDROID.
- Higher Success Rates: For complex tasks, such as calculating a total bill, the success rate of migrated tests improved by 10%.
- Significant Speedup: TRASM demonstrated a substantial reduction in execution time. In specific scenarios, TRASM achieved a 65% reduction in time (e.g., finishing in 890 seconds compared to CRAFTDROID's 2,581 seconds) by avoiding redundant calculations and storing explored paths.
Conclusion and Future Work
TRASM demonstrates that combining semantic understanding with reachability analysis significantly enhances the robustness of mobile test reuse. By moving beyond simple visual similarity and incorporating adaptive backtracking, the framework overcomes the "greedy trap" that plagues earlier tools.
Future research will focus on expanding the framework's validation to more diverse app categories, optimizing the computational overhead of the adaptive strategy, and developing automated "oracles" to verify the correctness of reused test outcomes.
Summary updated