Stop letting your AI agent test Android apps with screenshots
I shipped an Android app mostly by pairing with Claude Code. Writing features went fine. Testing them on a real phone did not. The problem When an AI coding agent tests an app on a device, the usual loop is: take a screenshot, look at it, decide where to tap, tap, take another screenshot. Every step sends an image to the model. A 20-step login-and-checkout flow can cost thousands of image tokens,…
AI coding agent Claude Code helped create an Android app, but testing on a real device proved challenging. Testing required a series of screenshots, which sent image tokens to the model, filled the context window, and sometimes led the agent to tap the incorrect item. Text-to-text testing was needed instead of visual testing. Android provides a uiautomator dump that returns all visible nodes with their text and coordinates.
The agent could be instructed to write the test steps in JSON format and run them with a single command. This approach reduced context window size and eliminated the need for visual decision-making by the AI agent, except when layout or color issues arose. Real devices revealed several problems: stale dumps, navigation bar issues, password input problems, apps stealing foreground, settings row matching issues, airplane mode inaccuracies, Wi-Fi connectivity issues, and USB wireless adb connectivity problems.
To address these issues, a Python-based device testing runner was created. This runner only requires standard Python libraries and ADB, and is MIT licensed. It is not a replacement for Espresso or Maestro but can be used as a single-file test generator for AI agents.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.