Test Reuse Based on Adaptive Semantic Matching across Android Mobile Applications

Shuqi Liu, Yu Zhou, Tingting Han, Taolue Chen · DOI

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.

The TRASM framework workflow, illustrating the two-phase process of preliminary preparation and adaptive source test reuse.

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.

Comparison of average reuse time between CRAFTDROID and TRASM across various app functionalities, demonstrating significant efficiency gains.

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

Empirical ResultsBrowse all benchmarks →

BenchmarkMethodMetricScoreProtocol / Evidence
b21 — Calculate total bill with tip (Tip Calculator)TRASMGUI event precision93%Gui Test Reuse · split: test · functionality=b21
Source quote
L228: TRASM │ 93% │ 100% │ 100% │ 90% │ 18/20(90%)
b21 — Calculate total bill with tip (Tip Calculator)TRASMAverage test reuse time890 secondsGui Test Reuse · split: test · functionality=b21
Source quote
L249: Efficiency. Figure ~\ref{fig4} lists the average test reuse time on each functionality. It is obvious that the average time spent on reuse testing of TRASM is less than that of CRAFTDROID for each functionality. Even the most significant effect is that for functionality b21, the average reuse test of CRAFTDROID takes 2581 seconds (43 minutes), while our TRASM only takes 890 seconds (15 minutes), which is close to 35% of the time of CRAFTDROID. In summary, the results are attributed to two factors. One is that the storage of explored paths avoids repeated time consumption, and the other is that the adaptive strategy improves the efficiency of widget matching. The above results prove that we can break through the limitation on efficiency in CRAFTDROID.
Reported baseline / comparator measurements (1)
BenchmarkMethodMetricScoreProtocol / Evidence
b21 — Calculate total bill with tip (Tip Calculator)CRAFTDROID baselineAverage test reuse time2581 secondsGui Test Reuse · split: test · functionality=b21
Source quote
L249: Efficiency. Figure ~\ref{fig4} lists the average test reuse time on each functionality. It is obvious that the average time spent on reuse testing of TRASM is less than that of CRAFTDROID for each functionality. Even the most significant effect is that for functionality b21, the average reuse test of CRAFTDROID takes 2581 seconds (43 minutes), while our TRASM only takes 890 seconds (15 minutes), which is close to 35% of the time of CRAFTDROID. In summary, the results are attributed to two factors. One is that the storage of explored paths avoids repeated time consumption, and the other is that the adaptive strategy improves the efficiency of widget matching. The above results prove that we can break through the limitation on efficiency in CRAFTDROID.
BibTeX
@inproceedings{liu2022test,
  author = {Shuqi Liu and Yu Zhou and Tingting Han and Taolue Chen},
  title = {{Test Reuse Based on Adaptive Semantic Matching across Android Mobile Applications}},
  booktitle = {QRS},
  year = {2022},
  doi = {10.1109/qrs57517.2022.00076},
}
Figure