Free · Daily brief + weekly playbookDaily 60-sec AI Voice Brief + Weekly Production AI Agent PlaybookGet the brief →
ReleaseInsight · On RadarHabr AI→ original

Claude Code checked 149 untouched buttons in an iOS app through UI tests

UI tests had never tapped 149 buttons in an iOS app, and the author did not want to check them by hand. He built a "remote control" into XCUITest, Apple's framework for UI tests: a test launches the app in the required state and executes Claude Code's commands from files. The agent grouped the buttons into 80 checks, and in 46 of them it confirmed a real gap in the tests. As a result, every new autotest also gives the agent a new starting point.

AI-processed from Habr AI; edited by Hamidun News
Claude Code checked 149 untouched buttons in an iOS app through UI tests
Source: Habr AI. Collage: Hamidun News.
Listen to article
Article Fact Sheet & Key Figures
ParameterDetails
Primary sourceHabr AI ↗
Editor-in-Chief
Over three days227 calls and 718 commands, with one call taking about 10 seconds
Start to ready with a finished build127 seconds at the median
Key metric #3A test plan with retries was substituting the user, and the agent did not notice

Imagine a UI test coverage report that shows 149 buttons in an iOS app that autotests never once tapped. Checking each one by hand takes a long time, because many of them live in awkward states: a user without verification, a forced update, a backend error. The author of the story on Habr decided to hand this routine to Claude Code. He set things up so the agent drives the app on a simulator itself, starting from any state the team's existing UI tests already know how to create. XCUITest here is Apple's framework for automated interface tests.

Why the "remote control" was built into the test itself

To check a button, you first have to get to its screen in the right state. The team's existing tests do this better than a human: they pick a suitable user from the test database, substitute backend responses via SBTUITestTunnel, enable feature flags, and open the app through a deep link. External tools such as Appium, idb, or a simulator MCP server see the app from the outside. They can tap, but they cannot prepare the state: they have no stubs and no test users.

So the author went the other way. One long-lived XCUITest launches the app like any ordinary test, writes a ready file, and waits for commands. Commands arrive as text files, cmd-N.txt: the simulator runs on the same Mac and can see its file system, so no ports or server were needed. The test executes the command, writes the response to out-N.txt, and saves a screenshot, shot-N.png. The agent reads the text, looks at the picture, and decides what to do next. Afterward, a person opens the same folder and walks through the session step by step.

Launch scenarios are copied from existing tests with a comment noting where they came from. On the first day there were 25 of them, and a new one takes 5–15 lines. If no command arrives for 40 minutes, the test ends on its own. The agent looks up elements by accessibility ID, and when an ID is missing, that goes into the report as an accessibility task.

Numbers and pitfalls

Over the first three days, the client handled 227 calls containing 718 commands, about three per call. The most frequent were wait (283), tap (218), and tree (170). A call that returns a response and a screenshot takes about 10 seconds. From start to ready with a finished build takes 127 seconds at the median (19 runs, ranging from 85 to 189); a cold build takes longer.

The most unpleasant bug: the agent called typeText on a field outside the screen, XCTest crashed the test, and the test plan's retry of failed tests relaunched the driver with a different user. The agent kept working in someone else's state. The fix: no single action may bring down the test. Before tapping, the driver checks that the element exists and can be tapped; otherwise it returns text such as NOT FOUND or NOT HITTABLE.

There was also a routine problem: Claude Code asked for confirmation on every command chained with ; or |. A rule in permissions.allow fixed it, but it only matches exactly one client command. So the client now accepts several commands separated by --, and the element tree filter moved inside.

There were plenty of small issues too. SwiftUI toggles do not switch when tapped in the center of the row, so a tapAt aimed at the switch itself was needed. swipeUp scrolls an entire screen, so a drag was added for precise scrolling. Identical labels cause the wrong button to be tapped, so the driver tries the id first. System alerts belong to SpringBoard, and the driver does not always see them.

What the agent found

Two illustrative sessions. In the first, the backend introduced mandatory acceptance of terms before the first stake. On DEV, the agent got to the confirmation, found a checkbox below the first screen and an inactive Stake button, ticked the checkbox, and reached the success screen. Along the way it also found in the code where the app decides to show the terms. This took 54 commands.

In the second, the author needed to buy €12 worth of bitcoin with a card requiring 3DS and record a video. The agent completed the whole path in about four minutes (the video runs 4:35). Along the way it noticed something it had not been asked about: saved cards on the payment selection screen have a "›" arrow, but tapping it is not handled in the code. And the card payment screens still contained text about bank transfers.

The main output was the coverage report. The agent went through the 149 buttons, which grouped into 80 check lines: about 57 were verified in the app, and another 23 through the code. For each one, it looked for the test that should have tapped it, tapped the button itself, and recorded the result. In 46 cases the gap was confirmed: the test really does not exist, and sometimes a Page Object method exists but no test calls it.

The practical takeaway for mobile teams: no separate infrastructure for the agent is required. Accumulated autotests already know how to bring the app into the needed state, and the more of them there are, the more starting points the agent has. To begin, it is enough to extract three to five launch scenarios and configure permissions so the agent does not ask for confirmation at every step. Also keep in mind that the driver depends on the UI test code, so an edit to a helper can break a scenario.

Story

Key Questions Answered

Why the "remote control" was built into the test itself?

To check a button, you first have to get to its screen in the right state. The team's existing tests do this better than a human: they pick a suitable user from the test database, substitute backend responses via SBTUITestTunnel, enable feature flags, and open the app through a deep link. External tools such as Appium, idb, or a simulator MCP server see the app from the outside. They can tap, but they cannot prepare the state: they have no stubs and no test users. So the author went the other way.

What are the key details on Numbers and pitfalls?

Over the first three days, the client handled 227 calls containing 718 commands, about three per call. The most frequent were wait (283), tap (218), and tree (170). A call that returns a response and a screenshot takes about 10 seconds. From start to ready with a finished build takes 127 seconds at the median (19 runs, ranging from 85 to 189); a cold build takes longer.

What the agent found?

Two illustrative sessions. In the first, the backend introduced mandatory acceptance of terms before the first stake. On DEV, the agent got to the confirmation, found a checkbox below the first screen and an inactive Stake button, ticked the checkbox, and reached the success screen. Along the way it also found in the code where the app decides to show the terms. This took 54 commands. In the second, the author needed to buy €12 worth of bitcoin with a card requiring 3DS and record a video.

ZK
Zhemal Khamidun — Head of AI at Alpina Digital · MIPT (academic supervisor of the Tech Entrepreneurship department). Building AI products since 2019. Hamidun News is a pet project that grew into a production aggregator with 6,000+ readers.
✦ Free · Waitlist · Hermes + DeepSeek

Free 2-Day Vibecoding & AI Agents Intensive

Day 1: the autonomous Hermes + DeepSeek AI agent — vibecoding and development on par with Claude Code / Codex / Gemini. Led by Jemal Hamidun, Head of AI at Alpina Digital and academic supervisor at MIPT. Right after you register with our bot Nika: the recording + 11 materials from the previous intensive.

Join the waitlist →Nomad AI Workspace
Jemal Hamidun

Editor-in-chief · Cite this analysis

Jemal Hamidun

Head of AI at Alpina Digital · Academic Supervisor of the Tech Entrepreneurship Department at MIPT

Head of AI & CPO of AlpinaGPT at Alpina Digital, Academic Lead of Tech Entrepreneurship at MIPT. Founder of Hamidun News and Vibe Academy.

Ready-to-paste citation for journalists, blogs and Telegram channels

Source: Hamidun News — Claude Code checked 149 untouched buttons in an iOS app through UI tests https://news.hamidun.com/en/news/18635/claude-code-checked-149-untouched-buttons-in-an-ios-app-thro

What do you think?
Loading comments…