xcodebuild-test
Execute unit and UI tests for Xcode projects with smart defaults that remember successful configurations and suggest optimal simulators, providing detailed test metrics with progressive disclosure to prevent token overflow.
Instructions
xcodebuild-test
⚡ Run Xcode tests with intelligent defaults and progressive disclosure
What it does
Executes unit and UI tests for Xcode projects with advanced learning that remembers successful test configurations and suggests optimal simulators per project. Provides detailed test metrics (passed/failed/skipped) with progressive disclosure to prevent token overflow. Supports test filtering (-only-testing, -skip-testing), test plans, and test-without-building mode for faster iteration. Learns from successful test runs to improve future suggestions.
Why you'd use it
Automatic smart defaults: remembers which simulator and config worked for tests
Detailed test metrics: structured pass/fail/skip counts instead of raw output
Progressive disclosure: concise summaries with full logs available via testId
Test filtering: run specific tests or skip problematic ones with -only-testing/-skip-testing
Parameters
Required
projectPath (string): Path to .xcodeproj or .xcworkspace file
scheme (string): Test scheme name (use xcodebuild-list to discover)
Optional
configuration (string, default: 'Debug'): Build configuration (Debug/Release, defaults to cached or "Debug")
destination (string): Test destination (e.g., "platform=iOS Simulator,id=")
sdk (string): SDK to test against (e.g., "iphonesimulator")
derivedDataPath (string): Custom derived data path
testPlan (string): Test plan name to execute
onlyTesting (string[]): Array of test identifiers to run exclusively
skipTesting (string[]): Array of test identifiers to skip
testWithoutBuilding (boolean): Run tests without building (requires prior build)
Returns
Structured JSON with testId (for progressive disclosure), success status, test summary (total/passed/failed/skipped counts), failure details (first 3 failures), and cache metadata showing which smart defaults were applied. Use xcodebuild-get-details with testId for full logs.
Examples
Run all tests with smart defaults
const result = await xcodebuildTestTool({
projectPath: "/path/to/MyApp.xcodeproj",
scheme: "MyApp"
});Run specific tests only
const filtered = await xcodebuildTestTool({
projectPath: "/path/to/MyApp.xcworkspace",
scheme: "MyApp",
onlyTesting: ["MyAppTests/testLogin", "MyAppTests/testLogout"]
});Fast iteration with test-without-building
const quick = await xcodebuildTestTool({
projectPath: "/path/to/MyApp.xcodeproj",
scheme: "MyApp",
testWithoutBuilding: true
});Complete JSON Examples
Run All Tests
{"projectPath": "/path/to/MyApp.xcodeproj", "scheme": "MyApp"}Run Specific Test Plan
{"projectPath": "/path/to/MyApp.xcodeproj", "scheme": "MyApp", "testPlan": "IntegrationTests"}Run Only Specific Tests
{"projectPath": "/path/to/MyApp.xcodeproj", "scheme": "MyApp", "onlyTesting": ["MyAppTests/LoginTests", "MyAppTests/AuthTests/testLogin"]}Skip Specific Tests
{"projectPath": "/path/to/MyApp.xcodeproj", "scheme": "MyApp", "skipTesting": ["MyAppTests/SlowTests", "MyAppUITests"]}Test Without Building (Using Previous Build)
{"projectPath": "/path/to/MyApp.xcodeproj", "scheme": "MyApp", "testWithoutBuilding": true}Test with Specific Destination
{"projectPath": "/path/to/MyApp.xcodeproj", "scheme": "MyApp", "destination": "platform=iOS Simulator,name=iPhone 16 Pro,OS=18.0"}Release Configuration Testing
{"projectPath": "/path/to/MyApp.xcodeproj", "scheme": "MyApp", "configuration": "Release"}Related Tools
xcodebuild-build: Build before testing
xcodebuild-get-details: Get full test logs (use with testId)
simctl-list: See available test simulators
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectPath | Yes | ||
| scheme | Yes | ||
| configuration | No | Debug | |
| destination | No | ||
| sdk | No | ||
| derivedDataPath | No | ||
| testPlan | No | ||
| onlyTesting | No | ||
| skipTesting | No | ||
| testWithoutBuilding | No |