Run tests with smart execution strategies - parallel, sequential, or split (UI sequential + unit parallel)
Execute tests with configurable parallelization strategy.
| Strategy | Flag | UI Tests | Unit Tests | Best For |
|---|---|---|---|---|
| Smart Split (Recommended) | --split | Sequential | Parallel | Daily development |
| All Sequential | --sequential | Sequential | Sequential | Maximum stability |
| All Parallel | --parallel | Parallel | Parallel | CI with clean state |
Ask which strategy to use, then execute accordingly.
Best balance of speed and stability. UI tests run sequentially (avoids clone issues), unit tests run in parallel (fast).
# Step 1: Run UI tests sequentially
xcodebuild test \
-scheme <SCHEME> \
-destination 'platform=iOS Simulator,name=<SIMULATOR>' \
-only-testing:<UI_TEST_TARGET> \
-parallel-testing-enabled NO
# Step 2: Run unit tests in parallel
xcodebuild test \
-scheme <SCHEME> \
-destination 'platform=iOS Simulator,name=<SIMULATOR>' \
-skip-testing:<UI_TEST_TARGET> \
-parallel-testing-enabled YES
Via XcodeBuildMCP:
# UI tests sequential
test_sim({ extraArgs: ["-only-testing:StuffolioUITests", "-parallel-testing-enabled", "NO"] })
# Unit tests parallel
test_sim({ extraArgs: ["-skip-testing:StuffolioUITests", "-parallel-testing-enabled", "YES"] })
Maximum stability. Use when experiencing any test flakiness.
xcodebuild test \
-scheme <SCHEME> \
-destination 'platform=iOS Simulator,name=<SIMULATOR>' \
-parallel-testing-enabled NO
Via XcodeBuildMCP:
test_sim({ extraArgs: ["-parallel-testing-enabled", "NO"] })
Fastest execution. Use with clean simulator state or in CI.
xcodebuild test \
-scheme <SCHEME> \
-destination 'platform=iOS Simulator,name=<SIMULATOR>' \
-parallel-testing-enabled YES \
-maximum-concurrent-test-simulator-destinations 2
Via XcodeBuildMCP:
test_sim({ extraArgs: ["-parallel-testing-enabled", "YES", "-maximum-concurrent-test-simulator-destinations", "2"] })
Based on Stuffolio (~4,700 total tests, ~195 UI tests):
| Strategy | Estimated Time | Notes |
|---|---|---|
| All Parallel | ~15-22 min | May have clone failures |
| Smart Split | ~50-60 min | UI sequential (~45 min) + unit parallel (~5 min) |
| All Sequential | ~60-75 min | Most stable, slowest |
Why UI tests are slow:
waitForExistence timeouts (up to 3-5 sec each)Rule of thumb: ~15-30 seconds per UI test when run sequentially.
If experiencing clone issues, run cleanup first:
# Kill zombie simulators
xcrun simctl shutdown all
killall Simulator 2>/dev/null
# Delete cloned simulators
xcrun simctl delete unavailable
# Optional: Clean DerivedData
rm -rf ~/Library/Developer/Xcode/DerivedData/<PROJECT>-*
To run tests while away from the computer, use /run-tests --unattended.
What this does:
--sequential / --parallel)Example invocations:
/run-tests --unattended # Smart Split (default)
/run-tests --unattended --sequential # All sequential
/run-tests --unattended --parallel # All parallel
/run-tests --unattended --cleanup # Run cleanup before tests
Permissions required (approve once before leaving):
| Tool | Permission | Approve With |
|---|---|---|
| XcodeBuildMCP | test_sim | Auto-allowed (MCP tool) |
| XcodeBuildMCP | boot_sim | Auto-allowed (MCP tool) |
| Bash | xcrun simctl | "Always allow" when prompted |
| Bash | killall Simulator | "Always allow" when prompted |
Tip: If using --cleanup, approve the Bash permissions once, then Claude will remember for the session.
--unattended)--cleanup flag presentTo find the UI test target:
# List schemes and targets
xcodebuild -list -project <PROJECT>.xcodeproj
Common UI test target patterns:
<AppName>UITests<AppName>-UITestsUITests