Mobile Development 8 min read

SmartMonkey: Android System‑Level Stability Testing Tool – Introduction, Features, and Usage Guide

This article introduces Baidu's SmartMonkey, an Android system‑level stability testing tool built on Robotium, outlines its key features such as accurate page interaction, configurable critical paths, performance data collection, and provides step‑by‑step instructions for project setup, configuration, test execution, and report analysis.

Baidu Intelligent Testing
Baidu Intelligent Testing
Baidu Intelligent Testing
SmartMonkey: Android System‑Level Stability Testing Tool – Introduction, Features, and Usage Guide

Background – Stable product quality is essential for user retention, making stability testing a core part of the testing suite. Baidu offers two widely used stability tools: the system‑level SmartMonkey and a customizable module‑level kernel stability tool.

Why SmartMonkey? The built‑in Android monkey tool generates random events without subjectivity, but its randomness limits functional extensions and can get stuck on simple pages. SmartMonkey, built on the Robotium framework, performs deep activity traversal and node operations, offering the following features:

1. Accurate page element identification to avoid invalid clicks. 2. Configurable critical paths for controllable test scope. 3. Dynamic operation priority to cover more functions and pages. 4. Automatic collection of multi‑process performance data. 5. Support for Checklist configuration for simple functional verification. 6. Integration with performance‑specialized tools to uncover performance issues.

How to Use SmartMonkey

1. Create an Android Test Project. 2. Modify AndroidManifest.xml – set the instrumentation tag’s name and targetPackage fields. 3. Import the required SmartMonkey libraries. 4. Add a JUnit test case in the src directory that extends the LynQ base class. 5. In the test case, define constants such as LAUNCHER_ACTIVITY_FULL_CLASSNAME (the app’s launcher activity) and TARGET_PACKAGE (the app’s package name). Example: private static final String LAUNCHER_ACTIVITY_FULL_CLASSNAME = "com.example.android.apis.ApiDemos"; private static final String TARGET_PACKAGE = "com.example.android.apis"; 6. Implement the test methods, e.g., public Test() throws ClassNotFoundException { super(TARGET_PACKAGE, Class.forName(LAUNCHER_ACTIVITY_FULL_CLASSNAME)); } public void test_sample() throws ClassNotFoundException { mSolo.sleep(10000); mSolo.analysis(); } 7. Add configuration files ( assets/AdvancedConfig.properties and assets/config.properties ) with items such as mReportPath , mLoginSwitch , mUsername , mPassword , mTimeSlot , mPerformanceReportType , mSleepTime , mDefaultText , mSpInputText , mNeverClick , mMustClick , and mMaxRunningTime . These control report output location, automatic login, performance collection interval, report format (HTML or XML), action interval, default input text, special input mappings, and critical‑path click rules.

8. Run the test via Run as Android JUnit Test .

Viewing SmartMonkey Output Reports

1. Crash information – SmartMonkey automatically records crash stack traces and native crash data. Crash logs are saved as stack*.txt files, while native dumps are stored as dmp* files viewable with Google‑Breakpad.

2. Basic performance report – Depending on configuration, SmartMonkey generates performance reports in HTML or XML format. The HTML report lists app package, UID, process IDs, and includes CPU, memory (PSS/USS), and traffic charts. Each chart node records the executed event to help locate performance spikes. The XML report logs each collection point with timestamps, total CPU usage, traffic deltas, and per‑process metrics.

Both report types provide visual and textual insights into stability and performance during automated testing.

Conclusion – Whether using the original monkey or the optimized SmartMonkey, both serve as system‑integration level stability tests. Future articles will introduce module‑level stability testing methods.

AndroidautomationPerformance Monitoringstability testingSmartMonkeyRobotium
Baidu Intelligent Testing
Written by

Baidu Intelligent Testing

Welcome to follow.

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.