Skip to content
Development
Skill

/axiom-run-tests

Use when the user wants to run XCUITests, parse test results, view test failures, or export test attachments.

From plugin
axiom
1.1k66 skills1 MCP
Install
$ npx -y skills add charleswiltgen/axiom --skill axiom-run-tests --agent claude-code

How it fires

How this skill gets triggered: by you, by Claude, or both.

  • Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
  • You can call itInvoke it directly when you want it.
  • Slash command/axiom-run-tests

Context preview

The summary Claude sees to decide when to auto-load this skill.

Use when the user wants to run XCUITests, parse test results, view test failures, or export test attachments.

SKILL.md

axiom-run-tests.SKILL.md
name: axiom-run-tests
description: Use when the user wants to run XCUITests, parse test results, view test failures, or export test attachments.
license: MIT
disable-model-invocation: true

> **Note:** This audit may use Bash commands to run builds, tests, or CLI tools.

Test Runner Agent

You are an expert at running XCUITests and analyzing test results using xcodebuild and xcresulttool.

Your Mission

1. Discover available test schemes and targets 2. Run tests with proper result bundle configuration 3. Parse test results for failures 4. Export failure attachments (screenshots, videos) 5. Provide actionable analysis

Mandatory First Steps

**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

Running Tests

Basic Test Execution

# 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 \
  > /tmp/xcodebuild-test.log 2>&1
# Redirect to a file — never pipe xcodebuild through `tee`/`grep`/`tail` (a pipe orphans
# the build if interrupted; see iOS-9). Structured results come from $RESULT_PATH below.

echo "Results saved to: $RESULT_PATH"

Running Specific Tests

# 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"

Parsing Test Results with xcresulttool

Get Test Summary

# 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

Get All Test Details

# Detailed test information (all tests with status)
xcrun xcresulttool get test-results tests --path "$RESULT_PATH"

Get Specific Test Details

# 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"

Export Failure Attachments

# 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

# Export all attachments (not just failures)
xcrun xcresulttool export attachments \
  --path "$RESULT_PATH" \
  --output-path "$ATTACHMENTS_DIR"

Export Code Coverage

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 Logs

# Get console output from tests
xcrun xcresulttool get log --path "$RESULT_PATH" --type console

Common Failure Patterns

Element Not Found

**Symptom**: `Failed to find element: Button with identifier 'loginButton'`

**Diagnosis**: 1. Missing accessibilityIdentifier 2. Element not visible (off-screen, hidden) 3. Wrong query (label changed, localization)

**Quick Fix**: Add accessibilityIdentifier to the element in code

Timeout Waiting for Element

**Symptom**: `Timed out waiting for element to exist`

**Diagnosis**: 1. App is slow (network, animation) 2. Element appears conditionally 3. waitForExistence timeout too short

**Quick Fix**: Increase timeout or add explicit wait

State Mismatch

**Symptom**: `Expected true, got false` or `Element exists but not hittable`

**Diagnosis**: 1. Race condition (UI updated between check and action) 2. Element behind another element 3. Keyboard covering element

**Quick Fix**: Wait for UI to stabilize, dismiss keyboard

Output Format

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**:
Read more
Ships withaxiom

Battle-tested skills, agents, and tools for modern Apple OS development — Swift 6, SwiftUI, Liquid Glass, Apple Intelligence, and more. Supports Claude Code, Codex, and all other popular coding harnesses and AI-savvy IDEs.

Get the whole plugin