Avgust: Automating Usage-Based Test Generation from Videos of App Executions

Yixue Zhao, Saghar Talebipour, Kesina Baral, Hyojae Park, Leon Yee, Safwat Ali Khan, Yuriy Brun, Nenad Medvidovic, Kevin Moran · DOI

Abstract

Writing and maintaining UI tests for mobile apps is a time-consuming and tedious task. While decades of research have produced automated approaches for UI test generation, these approaches typically focus on testing for crashes or maximizing code coverage. By contrast, recent research has shown that developers prefer usage-based tests, which center around specific uses of app features, to help support activities such as regression testing. Very few existing techniques support the generation of such tests, as doing so requires automating the difficult task of understanding the semantics of UI screens and user inputs. In this paper, we introduce Avgust, which automates key steps of generating usage-based tests. Avgust uses neural models for image understanding to process video recordings of app uses to synthesize an app-agnostic state-machine encoding of those uses. Then, Avgust uses this encoding to synthesize test cases for a new target app. We evaluate Avgust on 374 videos of common uses of 18 popular apps and show that 69% of the tests Avgust generates successfully execute the desired usage, and that Avgust's classifiers outperform the state of the art.

Introduction

Automated UI testing for mobile applications is currently dominated by two paradigms: "monkey testing," which uses random inputs to trigger crashes, and tools designed to maximize code coverage. While useful, these methods do not align with the practical needs of developers, who prioritize usage-based tests. These tests exercise specific functional scenarios—such as adding an item to a shopping cart or navigating a login flow—which are essential for regression testing.

Generating usage-based tests automatically remains a significant challenge due to three primary hurdles: the "scripting tax" (the need for manual scripts for source apps), "domain silos" (the difficulty of transferring logic between apps with different UI designs), and the "source code barrier" (the requirement for instrumentation or bytecode access). We present Avgust (Automating Usage-Based Test Generation), a vision-centric tool that addresses these challenges by learning from screen recordings of app executions.

Methodology

Avgust utilizes a three-phase pipeline to transform raw video pixels into executable test scripts without requiring access to the underlying source code.

1. Video Collection and Analysis

The process begins with screen recordings of users performing specific tasks. Avgust employs an enhanced version of the Video-to-Scenario (V2S) technique to identify touch actions and coordinates. To ensure security and data privacy, the system includes a custom CNN-based keyboard classifier that automatically filters out frames where sensitive information, such as passwords, is being entered.

2. AI-Assisted IR Model Generation

The core of Avgust is the generation of an Intermediate Representation (IR)—an abstract, app-agnostic state machine. This is achieved through two primary classification tasks:

  • Screen Classification: A hybrid model combines a convolutional autoencoder (pre-trained on 33,000 abstracted images from the RICO dataset) with BERT to process textual features extracted via Optical Character Recognition (OCR).
  • Widget Classification: This component uses ResNet for visual features and BERT for text, alongside spatial data, to categorize UI elements (e.g., identifying a "buy" button regardless of its specific aesthetic design).

3. Guided Test Scenario Generation

When a developer targets a new application, Avgust uses the learned IR model to provide top-k recommendations. It suggests which widgets the developer should interact with to replicate the desired usage scenario in the new environment, effectively acting as an intelligent assistant for test script creation.

Experimental Evaluation

We evaluated Avgust using a robust dataset consisting of:

  • Pre-training Data: 33,000 images from the RICO dataset for screen abstraction.
  • Evaluation Dataset: 374 video recordings covering 18 common usage scenarios (e.g., Search, Filter, Add to Cart) across 18 popular Android applications, including AliExpress, eBay, and Etsy.
  • Ground Truth: A manually labeled set of 2,478 screen labels and 2,434 widget labels.

Results and Discussion

Avgust demonstrated significant improvements over existing state-of-the-art methods:

  • Test Success Rate: The system successfully generated correct tests for 69% of the evaluated scenarios on entirely unseen target apps.
  • Classifier Performance: Avgust’s vision-only classifiers significantly outperformed S2V (a leading screen embedding tool), particularly in top-5 accuracy for both screen and widget identification.
  • Widget Accuracy: During live test generation, the widget classifier correctly recommended the appropriate UI element 77.4% of the time.
  • Partial Success: In the 31% of cases where tests did not fully succeed, the generated scripts still captured 79% of the correct states and 47% of the transitions, providing a substantial foundation for manual refinement.

The Power of Visual Abstraction

A key insight from our study is that relying on pixels rather than code makes the system platform-agnostic. By mapping specific UI elements (like a unique "Sign-In" button) to generic functional categories, Avgust can recognize intent across different apps. Interestingly, we found that incorporating runtime UI layout information (like XML hierarchies) actually decreased accuracy. The textual "noise" found in live apps—such as dynamic news headlines—tended to confuse models compared to the cleaner data provided by pure vision and OCR.

Conclusion

Avgust represents a significant step toward automating functional UI testing by leveraging neural image understanding and an app-agnostic intermediate representation. By placing the developer in the loop and focusing on visual semantics, Avgust reduces the manual effort required to maintain and port test suites across the fragmented mobile app ecosystem. Future work will focus on increasing automation levels and expanding the canonical widget categories to handle more complex UI components.

Summary updated

BibTeX
@inproceedings{zhao2022avgust,
  author = {Yixue Zhao and Saghar Talebipour and Kesina Baral and Hyojae Park and Leon Yee and Safwat Ali Khan and Yuriy Brun and Nenad Medvidovic and Kevin Moran},
  title = {{Avgust: Automating Usage-Based Test Generation from Videos of App Executions}},
  booktitle = {ESEC/SIGSOFT FSE},
  year = {2022},
  doi = {10.1145/3540250.3549134},
}
Figure