TL;DR
TRASM (Test Reuse based on Adaptive Semantic Matching) is a novel framework designed to transfer GUI tests between similar Android applications (e.g., from one To-Do list app to another). By combining an adaptive matching strategy with automated event deduplication, it significantly improves the success rate and speed of test migration compared to existing state-of-the-art tools.
What Problem Does This Paper Address?
Graphical User Interface (GUI) testing is essential for mobile apps but notoriously labor-intensive. While automatic test generation exists, a more efficient route is test reuse: taking a test suite designed for "App A" and running it on "App B" within the same category.
However, test reuse often fails because:
- Semantic Mismatch: Widgets (buttons, text fields) might have different labels or internal IDs across apps, even if they perform the same function.
- Layout Differences: A "greedy" matching algorithm might pick the most similar-looking widget on a screen, but that widget might lead to the wrong app state.
- Functional Redundancy: One app might have a "Welcome" or "Tutorial" screen that the other lacks. If the test tries to "click through" a screen that isn't there, the entire test fails.
Methods
The authors propose TRASM, which introduces two major innovations over previous methods like CRAFTDROID:
- GUI Events Deduplication: Before running the test on the target app, TRASM identifies and removes redundant events. For example, if the source app requires a "Next" click on a boot page that the target app doesn't have, TRASM detects this mismatch and skips the step to maintain the test's flow.
- Adaptive Semantic Matching: Instead of just picking the widget with the highest similarity score (the "greedy" approach), TRASM uses an adaptive strategy. It records instances where similarity scores are low or ambiguous. If a test path fails, it uses a Window Transition Graph (WTG)—a map of the app's screens and buttons—to backtrack and "rematch" events with better candidates that are actually reachable in the current app state.
- Semantic Calculation: To compare widgets, TRASM extracts attributes (text, resource-id, class) using the
adbtool and calculates similarity using Word2Vec models, which understand that words like "task" and "todo" are semantically related.
Datasets
The study evaluated TRASM using a benchmark dataset of 15 Android applications across three categories:
- Browsers (e.g., Lightning, Firefox Focus)
- Tip Calculators (e.g., Simple Tip Calculator)
- To-Do Lists (e.g., Minimal, Shopping List)
These apps were sourced from Google Play and F-Droid. The researchers tested six specific functionalities (e.g., "Add task," "Calculate total bill") across 30 different test cases.
Key Insights and Ideas
- The "Greedy" Trap: Most existing tools fail because they are too "short-sighted." By picking the best-looking match right now, they often miss the correct widget needed to progress the test later. TRASM’s "adaptation" allows it to be more flexible.
- Reachability is King: A widget might look 99% similar to the source, but if it doesn't lead to the next required screen, it's a bad match. Integrating the Window Transition Graph (WTG) ensures that matches are functionally viable, not just visually similar.
- Less is More: Deduplication isn't just about speed; it's about robustness. Removing "meaningless" events that don't exist in the target app prevents the test runner from getting "lost" in the UI.
Key Results
TRASM was compared against the baseline tool CRAFTDROID with impressive results:
- Higher Precision: TRASM improved GUI event matching precision by 5% to 15% across different functionalities.
- Better Success Rates: For complex tasks like "Calculate total bill," the success rate of reused tests increased by 10%.
- Significant Speedup: TRASM is much faster. In one scenario (calculating a bill), CRAFTDROID took 2,581 seconds, while TRASM finished in just 890 seconds—a 65% reduction in time. This is largely due to TRASM's ability to store explored paths and avoid redundant calculations.
Limitations and Future Work
The authors acknowledge a few areas for improvement:
- Computational Overhead: While TRASM is generally faster due to path storage, the adaptive strategy could theoretically increase time consumption if it has to search through many candidate widgets for a difficult match.
- Generalization: The current study focused on three app categories. Future work aims to verify TRASM on a wider variety of more complex applications.
- Oracle Generation: The authors plan to investigate how to automatically determine if a reused test actually "passed" (oracle generation) more accurately in future iterations.
Summary updated