Mobile Development 14 min read

Totoro: A Scalable Mobile Automation Testing Framework for Android, iOS, and Hybrid Apps

Totoro is an Ant Financial‑developed mobile automation testing framework that supports Android, iOS, HTML5, mini‑programs, Weex and Cube, featuring a two‑layer C/S architecture, full‑link stability mechanisms, intelligent app installation, comprehensive popup governance, AI‑assisted image detection, and a roadmap toward standardization and extensibility.

AntTech
AntTech
AntTech
Totoro: A Scalable Mobile Automation Testing Framework for Android, iOS, and Hybrid Apps

Totoro is an Ant Financial‑developed automation testing framework that supports Android, iOS, HTML5, mini‑programs, Weex, Cube and other mobile scenarios.

From zero to a mature solution, Totoro now serves more than ten business units within Alibaba, becoming one of the most widely used and stable automation frameworks in the group.

Totoro C/S Architecture Design

The framework adopts a two‑layer client/server model, shortening the call chain, simplifying project structure, and ensuring high‑speed, stable automation execution.

Full‑Link Stability Construction

Stability is addressed on five dimensions: program exception governance, host‑service reliability, device link robustness, network stability, and hardware hub resilience.

1. Program Exception Governance

All exception stacks are collected and classified into business‑level and SDK‑level issues. SDK bugs are fixed, business exceptions are abstracted into clear prompts with suggested actions, and retry mechanisms are added. A unified test‑lifecycle hook allows developers to embed custom logic at each stage.

2. Phone Host Service Stability

When the core services (TotoroUiautomator/TotoroWDA) on the device fail, the framework automatically restarts them, monitors the daemon process, and performs port‑forward recovery through network probing.

3. Device Link Strategy

Software recovery attempts ADB restart up to three times, followed by USB reset if needed. For chronic flaky devices, the system switches to a lower‑requirement device pool. A custom SmartHub provides remote power control, voltage adjustment and reset for each USB port.

4. Network Stability

Network snapshots are taken at failure points, the SLM cloud‑terminal service auto‑connects to the appropriate network and resets on anomalies, and the cluster cabinets are isolated to guarantee hotspot stability.

5. Multi‑Dimensional Success‑Rate Boost

Strategies such as DeviceChange, DeviceReboot, automatic retry, and DingTalk alerts are employed to mitigate intermittent failures and improve overall test success rates.

Android App Fully Automatic Intelligent Installation

Totoro replaces Appium with a custom Uiautomator1‑based installer that runs without installation. It abstracts popup patterns across thousands of device models, dumps UI controls, matches keywords, and provides a safety‑failure alarm for rapid compatibility updates.

Full‑Scene Popup Governance

The framework deep‑modifies the Android UiDevice.registerWatcher interface, registers keyword, fuzzy‑match, desc, resource‑ID and target‑action listeners, and triggers actions via runWatchers() . The original JavaDoc snippet is preserved below:

/**
 * Registers a {@link UiWatcher} to run automatically when the testing framework is unable to
 * find a match using a {@link UiSelector}. See {@link #runWatchers()}
 * @since API Level 16
 */

To handle non‑native pages (H5 / mini‑programs) where UI dump is unavailable, a machine‑learning image‑detection pipeline analyses screenshots and generates click coordinates. A custom dump‑algorithm converts app screenshots into raw control maps, enabling reliable popup handling in hybrid scenarios.

Milestones and Future Planning

After nearly three years of rapid iteration, Totoro’s stability has markedly improved, and more BU teams are adopting it for mobile cloud testing. The roadmap focuses on standardization, extensibility, multi‑language support, plugin architecture, deeper AI integration, and building an open developer community.

AImobile testingstabilityautomation frameworkSmartHubTotoro
AntTech
Written by

AntTech

Technology is the core driver of Ant's future creation.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.