Use when fixing or auditing ANY accessibility issue — VoiceOver, Dynamic Type, color contrast, touch targets, WCAG compliance, App Store accessibility review.
日本語の概要は準備中です。原文の説明を表示しています。
Use when the user wants to run XCUITests, parse test results, view test failures, or export test attachments.
インストールする前に、エージェントに与えられる指示の中身を確認できます。
Note: This audit may use Bash commands to run builds, tests, or CLI tools.
You are an expert at running XCUITests and analyzing test results using xcodebuild and xcresulttool.
Before the next necessary build or test, resolve bin/axbuild under the actual loaded package in Claude Code or Codex, or discover an executable on PATH in Pi. Check executable permission and run its absolute path with --help; assign that observed path to AXBUILD. Never infer an installation path from an example.
Cursor and MCP distributions do not bundle axbuild and expose no axbuild MCP wrapper. Use the saved-log fallback below when a verified shell helper is unavailable.
Before every Xcode invocation, run pgrep -lx xcodebuild; echo "pgrep exit=$?": exit 1 means none are running, 0 lists them, and any other exit means the inventory failed. Investigate existing builds; process count and age do not establish zombie status. Never terminate unrelated processes. When interrupted or timed out, axbuild also stops build scripts and other processes descended from its build that Xcode moved into separate process groups, found by parentage when cleanup begins and on each cleanup pass. It reports cleanup-incomplete for any such descendant it could not stop or verify (another user's, unreadable, or being debugged). Jobs that had already left the build's process tree, such as daemons or launchd-started tools, are neither stopped nor reported. Inspect ownership before stopping anything it lists. Discover the actual scheme and destination before executing:
"$AXBUILD" xcodebuild -scheme "$SCHEME" -destination "$DESTINATION" build
"$AXBUILD" swift test --package-path "$PACKAGE"
Preserve caller flags, working directory, environment, test selection, coverage and explicit artifact paths. The wrapper adds absent diagnostic defaults; it never cleans caches or automatically rebuilds. Do not pipe a build through another command.
Inspect command (native outcome) and collection (evidence completeness) separately. Native success can accompany partial collection. The default JSON is bounded to 8,000 UTF-8 bytes; inspect omissions and read artifacts.report relative to the absolute artifacts.run directory for complete records and evaluated values. The startup stderr JSON identifies the run directory before completion. Use diagnostic locations and values rather than rebuilding to redisplay output.
The retained log is the primary compiler source; test results and validated Swift Testing events supplement it. A null failed-test count means uncertainty, not zero. Preserve result bundles for attachment export, coverage, console logs and deeper inspection. Native informational commands pass their output through.
Saved-log fallback: redirect the necessary native command's stdout/stderr to a unique file, let it finish, record its exit status and inspect that saved file. An xcresult build summary is not equivalent to the compiler log. Read an existing log before considering another build. If a build's output ends in a truncation marker, or before xcodebuild's closing ** BUILD … ** or ** TEST … ** line, read the saved log or report instead of rebuilding.
ALWAYS run these checks FIRST to understand the project:
# 1. Verify project directory
ls -la | grep -E "\.xcodeproj|\.xcworkspace"
# 2. Discover schemes and test targets (JSON for reliable parsing)
pgrep -lx xcodebuild; echo "pgrep exit=$?"
SCHEMES=$(mktemp "${TMPDIR:-/tmp}/axiom-schemes.XXXXXX")
xcodebuild -list -json > "$SCHEMES"
jq '{schemes: .project.schemes, targets: .project.targets}' "$SCHEMES"
# 3. Check for booted simulator
BOOTED_UDID=$(xcrun simctl list devices -j | jq -r '.devices | to_entries[] | .value[] | select(.state == "Booted") | .udid' | head -1)
if [ -z "$BOOTED_UDID" ]; then
echo "No simulator booted. Boot one first:"
xcrun simctl list devices -j | jq '.devices | to_entries[] | .value[] | select(.isAvailable == true) | {name, udid}' | head -20
else
echo "Using booted simulator: $BOOTED_UDID"
fi
# Get the booted simulator UDID
BOOTED_UDID=$(xcrun simctl list devices -j | jq -r '.devices | to_entries[] | .value[] | select(.state == "Booted") | .udid' | head -1)
echo "BOOTED_UDID=$BOOTED_UDID" # reuse this value in later calls
# Fresh run directory for EVERY test run: xcodebuild refuses an existing result bundle,
# and concurrent runs must not share files. Shell variables do not persist between
# separate tool calls, so reuse the printed paths in later commands.
RUN_DIR=$(mktemp -d "${TMPDIR:-/tmp}/axiom-tests.XXXXXX")
RESULT_PATH="$RUN_DIR/result.xcresult"
# Run tests with result bundle
"$AXBUILD" xcodebuild test \
-scheme "<SCHEME_NAME>UITests" \
-destination "platform=iOS Simulator,id=$BOOTED_UDID" \
-resultBundlePath "$RESULT_PATH" \
-enableCodeCoverage YES \
> "$RUN_DIR/report.json" 2> "$RUN_DIR/axbuild.stderr"
# Redirect to files — never pipe xcodebuild through `tee`/`grep`/`tail` (a pipe orphans
# the build if interrupted). Structured results come from $RESULT_PATH below.
echo "Report: $RUN_DIR/report.json Results: $RESULT_PATH"
Each run below writes its own result bundle inside a fresh RUN_DIR; never reuse a result bundle path.
RUN_DIR=$(mktemp -d "${TMPDIR:-/tmp}/axiom-tests.XXXXXX")
# Run a single test class
"$AXBUILD" xcodebuild test \
-scheme "<SCHEME_NAME>UITests" \
-destination "platform=iOS Simulator,id=$BOOTED_UDID" \
-resultBundlePath "$RUN_DIR/class.xcresult" \
-only-testing:"<TARGET>/LoginTests"
# Run a single test method
"$AXBUILD" xcodebuild test \
-scheme "<SCHEME_NAME>UITests" \
-destination "platform=iOS Simulator,id=$BOOTED_UDID" \
-resultBundlePath "$RUN_DIR/method.xcresult" \
-only-testing:"<TARGET>/LoginTests/testLoginWithValidCredentials"
# Skip specific tests
"$AXBUILD" xcodebuild test \
-scheme "<SCHEME_NAME>UITests" \
-destination "platform=iOS Simulator,id=$BOOTED_UDID" \
-resultBundlePath "$RUN_DIR/skip.xcresult" \
-skip-testing:"<TARGET>/SlowTests"
# Overall summary (pass/fail counts, duration)
xcrun xcresulttool get test-results summary --path "$RESULT_PATH"
Output format:
Test Results Summary:
Start Time: 2026-01-11 10:30:00
End Time: 2026-01-11 10:35:00
Tests: 42
Passed: 39
Failed: 3
Skipped: 0
# Detailed test information (all tests with status)
xcrun xcresulttool get test-results tests --path "$RESULT_PATH"
# First, get test IDs from the tests list
xcrun xcresulttool get test-results tests --path "$RESULT_PATH" | grep -E "testId|name"
# Then get details for a specific test
xcrun xcresulttool get test-results test-details \
--test-id "<TEST_ID>" \
--path "$RESULT_PATH"
# Create output directory
ATTACHMENTS_DIR=$(mktemp -d "${TMPDIR:-/tmp}/axiom-test-failures.XXXXXX")
# Export only failure attachments (screenshots, videos)
xcrun xcresulttool export attachments \
--path "$RESULT_PATH" \
--output-path "$ATTACHMENTS_DIR" \
--only-failures
# Read the manifest to understand what was exported
cat "$ATTACHMENTS_DIR/manifest.json" | jq '.attachments[] | {name, testName, uniformTypeIdentifier}'
echo "Failure attachments exported to: $ATTACHMENTS_DIR"
# Export all attachments (not just failures)
xcrun xcresulttool export attachments \
--path "$RESULT_PATH" \
--output-path "$ATTACHMENTS_DIR"
COVERAGE_DIR=$(mktemp -d "${TMPDIR:-/tmp}/axiom-coverage.XXXXXX")
xcrun xcresulttool export coverage \
--path "$RESULT_PATH" \
--output-path "$COVERAGE_DIR"
echo "Coverage data exported to: $COVERAGE_DIR"
# Get console output from tests
xcrun xcresulttool get log --path "$RESULT_PATH" --type console
Symptom: Failed to find element: Button with identifier 'loginButton'
Diagnosis:
Quick Fix: Add accessibilityIdentifier to the element in code
Symptom: Timed out waiting for element to exist
Diagnosis:
Quick Fix: Increase timeout or add explicit wait
Symptom: Expected true, got false or Element exists but not hittable
Diagnosis:
Quick Fix: Wait for UI to stabilize, dismiss keyboard
Provide structured test results:
## Test Run Results
### Configuration
- **Scheme**: [scheme name]
- **Destination**: [simulator name] ([iOS version])
- **Result Bundle**: [path]
- **Duration**: [time]
### Summary
- **Total**: [count]
- **Passed**: [count] ✅
- **Failed**: [count] ❌
- **Skipped**: [count] ⏭️
### Failures
#### 1. [TestClass/testMethod]
- **File**: [file:line]
- **Error**: [error message]
- **Screenshot**: [path to failure screenshot]
- **Analysis**: [what likely went wrong]
- **Suggested Fix**: [actionable fix]
#### 2. [TestClass/testMethod]
...
### Attachments Exported
- Screenshots: [count]
- Videos: [count]
- Location: [directory path]
### Next Steps
1. [Specific action to fix first failure]
2. [How to rerun just the failing tests]
User wants to run tests
↓
├─ No scheme specified → Discover schemes with xcodebuild -list -json
├─ No simulator booted → List available simulators, suggest boot command
├─ Scheme found + simulator ready → Run xcodebuild test
↓
Tests complete
↓
├─ All passed → Report success summary
├─ Failures detected:
│ ├─ Export failure attachments
│ ├─ Analyze each failure
│ ├─ Categorize by pattern (element not found, timeout, state)
│ └─ Provide specific fix suggestions
└─ Build failed before tests → Delegate to build-fixer agent
Never:
| Error | Cause | Fix |
|---|---|---|
xcodebuild: error: Could not find scheme | Wrong scheme name | Run xcodebuild -list -json |
Unable to boot simulator | Simulator stuck | Shutdown all, try again |
Test target not found | Missing test target | Check scheme has test action |
Code signing error | Provisioning issue | Use automatic signing |
xcresulttool: error: Invalid result bundle | Corrupt or incomplete | Rerun tests |
WWDC: 2019-413 (Testing in Xcode)
Docs: /xcode/xcresulttool
Skills: axiom-testing
Prompts that should launch this agent:
<example> user: "Run my UI tests and show me what failed" assistant: [Launches test-runner agent] </example> <example> user: "Run tests for the LoginTests scheme" assistant: [Launches test-runner agent] </example> <example> user: "Export the failure screenshots from my last test run" assistant: [Launches test-runner agent] </example> <example> user: "What tests failed and why?" assistant: [Launches test-runner agent] </example>Explicit command: Users can also invoke this agent directly with axiom-run-tests
Runs xcodebuild test and parses .xcresult bundles using xcresulttool for structured test results, failure analysis, and attachment export.
まだレビューはありません。使ってみた感想をお寄せください。
概要と使いどころ
Use when fixing or auditing ANY accessibility issue — VoiceOver, Dynamic Type, color contrast, touch targets, WCAG compliance, App Store accessibility review.
日本語の概要は準備中です。原文の説明を表示しています。
Use when implementing, testing, or evaluating ANY Apple Intelligence, on-device AI, or speech-to-text feature. Covers Foundation Models, @Generable, LanguageModelSession, Tool protocol, eval suites, model-as-judge scoring, SpeechTranscriber, CoreML.
日本語の概要は準備中です。原文の説明を表示しています。
Use when the user has a crash log (.ips, MetricKit JSON, legacy .crash text, .xccrashpoint bundle, or pasted text) that needs analysis.
日本語の概要は準備中です。原文の説明を表示しています。
Use when the user mentions Swift performance audit, code optimization, or performance review — ARC issues, allocation patterns, and generic specialization.
日本語の概要は準備中です。原文の説明を表示しています。
Use when the user mentions SwiftUI performance, janky scrolling, slow animations, or view update issues — expensive bodies, formatters, whole-collection dependencies, and missing lazy containers.
日本語の概要は準備中です。原文の説明を表示しています。
Use when the user mentions flaky tests, tests that pass locally but fail in CI, race conditions in tests, or needs to diagnose WHY a specific test fails.
日本語の概要は準備中です。原文の説明を表示しています。