axiom-codex/skills/axiom-run-tests/SKILL.md
Use when the user wants to run XCUITests, parse test results, view test failures, or export test attachments.
npx skillsauth add charleswiltgen/axiom axiom-run-testsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
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.
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)
xcodebuild -list -json | jq '{schemes: .project.schemes, targets: .project.targets}'
# 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)
# Create timestamped result bundle path
RESULT_PATH="/tmp/test-$(date +%s).xcresult"
# Run tests with result bundle
xcodebuild test \
-scheme "<SCHEME_NAME>UITests" \
-destination "platform=iOS Simulator,id=$BOOTED_UDID" \
-resultBundlePath "$RESULT_PATH" \
-enableCodeCoverage YES \
2>&1 | tee /tmp/xcodebuild-test.log
echo "Results saved to: $RESULT_PATH"
# Run a single test class
xcodebuild test \
-scheme "<SCHEME_NAME>UITests" \
-destination "platform=iOS Simulator,id=$BOOTED_UDID" \
-resultBundlePath "$RESULT_PATH" \
-only-testing:"<TARGET>/LoginTests"
# Run a single test method
xcodebuild test \
-scheme "<SCHEME_NAME>UITests" \
-destination "platform=iOS Simulator,id=$BOOTED_UDID" \
-resultBundlePath "$RESULT_PATH" \
-only-testing:"<TARGET>/LoginTests/testLoginWithValidCredentials"
# Skip specific tests
xcodebuild test \
-scheme "<SCHEME_NAME>UITests" \
-destination "platform=iOS Simulator,id=$BOOTED_UDID" \
-resultBundlePath "$RESULT_PATH" \
-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="/tmp/test-failures-$(date +%s)"
mkdir -p "$ATTACHMENTS_DIR"
# 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="/tmp/coverage-$(date +%s)"
mkdir -p "$COVERAGE_DIR"
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 |
User: "Run the UI tests and tell me what failed"
Your response:
xcodebuild -list -jsonxcodebuild test -scheme "AppUITests" -resultBundlePath /tmp/test-xxx.xcresultxcrun xcresulttool get test-results summaryxcrun xcresulttool export attachments --only-failuresWWDC: 2019-413 (Testing in Xcode)
Docs: /xcode/xcresulttool
Skills: axiom-testing
For build issues: build-fixer agent
For visual verification: simulator-tester agent
For closed-loop debugging: test-debugger agent
development
Use when building ANY watchOS app — app structure, independent apps, Watch Connectivity, Smart Stack widgets, complications, controls, RelevanceKit, background tasks, ClockKit migration.
development
Use when working with HealthKit, WorkoutKit, health data, workouts, or fitness features on iOS or watchOS. Covers permissions, queries, background delivery, custom workouts, multidevice coordination.
development
Use when building, fixing, or improving ANY SwiftUI UI — views, navigation, layout, animations, performance, architecture, gestures, debugging, iOS 26 features.
content-media
Use when working with camera, photos, audio, haptics, ShazamKit, or Now Playing. Covers AVCaptureSession, PHPicker, PhotosPicker, AVFoundation, Core Haptics, audio recognition, MediaPlayer, CarPlay, MusicKit.