Design and Implementation of a Mobile Automation Testing Framework for Youku APP
The article describes how a three‑layer, cross‑platform mobile automation framework was designed and implemented for the Youku app, integrating driver, encapsulation, and test‑case layers with utilities, logging, image‑recognition and platform reporting to streamline regression testing, cut labor costs, and guide future enhancements.
During the construction of automated testing capabilities, selecting an automation framework, designing its core, and integrating it with an automation platform are critical steps. This article shares the experience of building an automated testing capability for the Youku mobile app.
Background
Rapid iteration of mobile versions has made fast testing and feedback a routine process. The increased release frequency shortens testing windows, and regression tasks are abundant, requiring regression testing at every stage to ensure module correctness after integration.
The main pain points in current regression testing are:
Unclear priorities in regression testing, making it hard to complete many cases in a short time.
Most regression cases are executed manually, leading to low efficiency.
Various teams develop isolated automation tools that do not cooperate, preventing the sharing of tool benefits.
To address these issues, a client‑side automation capability was encapsulated into a framework that seamlessly connects script writing and execution with the automation platform, unifies core case development, and reduces overall regression cost.
Automation Framework Selection Criteria
A good automation framework should have:
Cross‑platform consistency : iOS and Android test cases can be written in the same framework, improving script development efficiency.
Runtime stability : The framework must be stable enough to tolerate UI automation’s inherent flakiness.
Ease of use : Simple onboarding lowers the entry barrier for testers.
Low coupling : Layers remain loosely coupled to reduce maintenance cost and to enable easy integration with platforms and script calls.
Framework Architecture
The framework is organized into three layers:
Driver layer : Provides core driving capabilities and manages the lifecycle of each test case.
Framework encapsulation layer : Depends on the driver layer, offers a generic BaseCase entry, utility classes, and abstracts common business capabilities.
TestCase layer : Depends on the encapsulation layer, contains business logic and concrete test cases. The layers are decoupled and depend only on the layer directly below them.
The overall structure consists of four major modules:
Framework_Core : Extends BaseCase , which is the entry point for all cases and holds the driver object throughout the case lifecycle.
Device_Config : Initializes device‑related information such as device ID and package name.
Utility : Encapsulates helper classes, including image processing and navigation functions, to make verification more comprehensive and accurate.
Report : Generates standardized test reports that can be consumed by the automation platform.
Log and Check Systems
The framework provides a complete Log system for tracing test execution and generating reports. Log entries include adding case steps, screenshots, verification points, and operation logs.
In addition, a Check system is implemented to verify element existence, string equality, text emptiness, and image similarity, offering richer validation than simple assertions.
Basic operations such as pageSwipe (screen‑size‑aware swipe) and moduleSwipe (swipe within a given element) are also encapsulated to simplify script development.
Image Recognition Capability
Beyond traditional UI automation, the framework adds data‑driven and image‑based capabilities. It provides APIs for image handling, including screenshot annotation, image cropping for OCR, similarity comparison, and image flipping to handle orientation changes on tablets.
Platform Integration
The automated testing solution integrates with an automation capability platform, offering a result dashboard that displays test duration, case count, success/failure numbers, and pass rate. The platform also supports crash analysis per test case, bug submission for failed cases, and detailed failure screenshots with trace information.
Future Plans
The platform has already improved regression efficiency and reduced labor costs. Future work will focus on further enhancing image recognition capabilities and delivering more valuable automated testing solutions.
Youku Technology
Discover top-tier entertainment technology here.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.