Introduction

Written by the author, AI-editedAI-generated, author-verified How this module was made

Heads up... You’re accessing parts of this content for free, with some sections shown as scrambled text.

Heads up... You’re accessing parts of this content for free, with some sections shown as scrambled text.

Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.

Unlock now

The unit tests from the previous lesson guard the logic underneath the AI Usage Insights feature, but nothing so far has verified what a person actually experiences, when they tap through the app. That’s a different kind of testing: instead of asserting on a return value, you’re asserting on what appears on screen after a real interaction.

Xcode 27 exposes the iOS simulator through MCP, which means an AI agent can drive a running app directly — tap buttons, scroll lists, read what’s on screen — the same way a QA engineer would, without you writing a single line of automation first. In this lesson, you’ll turn the reviewed feature plan into a set of plain-English test steps — actions to take in the app, and expectations to find on screen — and have the agent execute those steps itself, live against the simulator, rather than generating test code for someone else to run.

Not every question is answered by what’s on screen, though. Sometimes you need to know what’s happening underneath the UI — what a variable actually held at a given moment. You’ll see how an AI agent can set its own breakpoints in Xcode, run the app, and when execution stops, print the data it needs straight to the console — effectively debugging the app the same way you would, by stepping through code and reading what comes out of the debug session.

Driving the simulator through screenshots on every step is not cheap: each screenshot is fresh, uncached tokens, so this approach trades token cost for the ability to test the app, the way a user actually experiences it. Keep that trade-off in mind when deciding where to spend it.

By the end of this lesson you’ll be able to:

  • Use an AI agent and Xcode’s simulator MCP to execute a UI test — actions and expectations — directly against a running app.
  • Have an AI agent set breakpoints and read console output from a live debug session to verify internal state.
  • Recognize the token cost of screenshot-driven simulator testing and when it’s worth paying.
See forum comments
Download course materials from Github
Previous: Quiz: Fix Bugs & Guard Them With Tests Next: Testing the Running App With an AI Agent