Record Test Step
test-record-stepRecord a named step in a test session by capturing a screenshot and accessibility tree snapshot, saving them with metadata to a persistent session directory for structured testing evidence.
Instructions
test-record-step
Record a single named step in a test session, capturing a screenshot and accessibility tree snapshot.
What it does
Maintains a persistent session directory under ~/.xc-mcp/test-recordings/<sessionName>/
(override root with env var XC_MCP_RECORDINGS_DIR). Each call:
Creates the session directory + steps.json on first call
Captures a screenshot via
xcrun simctl io <udid|booted> screenshotCaptures an accessibility tree via
idb ui describe-all(tolerates idb absence)Appends a step record to steps.json with sequential index (001, 002, …)
Session layout:
~/.xc-mcp/test-recordings/<sessionName>/
steps.json – session metadata + all step records
screenshots/ – NNN-<label>.png per step
accessibility/ – NNN-<label>.json per step (idb NDJSON or error stub)
report.md – generated by test-record-reportParameters
sessionName (string, required): Unique session identifier (used as directory name)
label (string, required): Human-readable description of this step
udid (string, optional): Simulator UDID — defaults to
bootedmetadata (object, optional): Arbitrary key-value pairs attached to step record
assertion (string, optional): Assertion description recorded with step
Returns
JSON with { sessionName, stepIndex, label, screenshot, accessibilityFile, elementCount, timestampMs }
plus guidance for next steps.
Examples
Record first step
await testRecordStepTool({ sessionName: "login-flow", label: "App launched" })Step with assertion and metadata
await testRecordStepTool({
sessionName: "login-flow",
label: "Login succeeded",
assertion: "Home screen is visible",
metadata: { user: "test@example.com", env: "staging" }
})Specific simulator
await testRecordStepTool({
sessionName: "login-flow",
label: "Credentials entered",
udid: "device-123"
})Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| udid | No | ||
| label | Yes | Human description of this step | |
| metadata | No | ||
| assertion | No | ||
| sessionName | Yes | Recording session name |