xc-mcp
Version:
MCP server that wraps Xcode command-line tools for iOS/macOS development workflows
71 lines • 7.43 kB
TypeScript
/**
* 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:**
* - projectPath (string, required): Path to .xcodeproj or .xcworkspace file
* - scheme (string, required): Test scheme name (use xcodebuild-list to discover)
* - configuration (string, optional): Build configuration (Debug/Release, defaults to cached or "Debug")
* - destination (string, optional): Test destination (e.g., "platform=iOS Simulator,id=<UDID>")
* - sdk (string, optional): SDK to test against (e.g., "iphonesimulator")
* - derivedDataPath (string, optional): Custom derived data path
* - testPlan (string, optional): Test plan name to execute
* - onlyTesting (string[], optional): Array of test identifiers to run exclusively
* - skipTesting (string[], optional): Array of test identifiers to skip
* - testWithoutBuilding (boolean, optional): 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.
*
* **Example:**
* ```typescript
* // 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
* });
* ```
*
* **Full documentation:** See src/tools/xcodebuild/test.md for detailed parameters
*
* @param args Tool arguments containing projectPath, scheme, and optional test configuration
* @returns Tool result with test metrics and testId for progressive disclosure
*/
export declare function xcodebuildTestTool(args: any): Promise<{
content: {
type: "text";
text: string;
}[];
isError: boolean;
}>;
export declare const XCODEBUILD_TEST_DOCS = "\n# xcodebuild-test\n\n\u26A1 **Run Xcode tests** with intelligent defaults and progressive disclosure\n\n## What it does\n\nExecutes 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.\n\n## Why you'd use it\n\n- Automatic smart defaults: remembers which simulator and config worked for tests\n- Detailed test metrics: structured pass/fail/skip counts instead of raw output\n- Progressive disclosure: concise summaries with full logs available via testId\n- Test filtering: run specific tests or skip problematic ones with -only-testing/-skip-testing\n\n## Parameters\n\n### Required\n- **projectPath** (string): Path to .xcodeproj or .xcworkspace file\n- **scheme** (string): Test scheme name (use xcodebuild-list to discover)\n\n### Optional\n- **configuration** (string, default: 'Debug'): Build configuration (Debug/Release, defaults to cached or \"Debug\")\n- **destination** (string): Test destination (e.g., \"platform=iOS Simulator,id=<UDID>\")\n- **sdk** (string): SDK to test against (e.g., \"iphonesimulator\")\n- **derivedDataPath** (string): Custom derived data path\n- **testPlan** (string): Test plan name to execute\n- **onlyTesting** (string[]): Array of test identifiers to run exclusively\n- **skipTesting** (string[]): Array of test identifiers to skip\n- **testWithoutBuilding** (boolean): Run tests without building (requires prior build)\n\n## Returns\n\nStructured 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.\n\n## Examples\n\n### Run all tests with smart defaults\n```typescript\nconst result = await xcodebuildTestTool({\n projectPath: \"/path/to/MyApp.xcodeproj\",\n scheme: \"MyApp\"\n});\n```\n\n### Run specific tests only\n```typescript\nconst filtered = await xcodebuildTestTool({\n projectPath: \"/path/to/MyApp.xcworkspace\",\n scheme: \"MyApp\",\n onlyTesting: [\"MyAppTests/testLogin\", \"MyAppTests/testLogout\"]\n});\n```\n\n### Fast iteration with test-without-building\n```typescript\nconst quick = await xcodebuildTestTool({\n projectPath: \"/path/to/MyApp.xcodeproj\",\n scheme: \"MyApp\",\n testWithoutBuilding: true\n});\n```\n\n## Complete JSON Examples\n\n### Run All Tests\n```json\n{\"projectPath\": \"/path/to/MyApp.xcodeproj\", \"scheme\": \"MyApp\"}\n```\n\n### Run Specific Test Plan\n```json\n{\"projectPath\": \"/path/to/MyApp.xcodeproj\", \"scheme\": \"MyApp\", \"testPlan\": \"IntegrationTests\"}\n```\n\n### Run Only Specific Tests\n```json\n{\"projectPath\": \"/path/to/MyApp.xcodeproj\", \"scheme\": \"MyApp\", \"onlyTesting\": [\"MyAppTests/LoginTests\", \"MyAppTests/AuthTests/testLogin\"]}\n```\n\n### Skip Specific Tests\n```json\n{\"projectPath\": \"/path/to/MyApp.xcodeproj\", \"scheme\": \"MyApp\", \"skipTesting\": [\"MyAppTests/SlowTests\", \"MyAppUITests\"]}\n```\n\n### Test Without Building (Using Previous Build)\n```json\n{\"projectPath\": \"/path/to/MyApp.xcodeproj\", \"scheme\": \"MyApp\", \"testWithoutBuilding\": true}\n```\n\n### Test with Specific Destination\n```json\n{\"projectPath\": \"/path/to/MyApp.xcodeproj\", \"scheme\": \"MyApp\", \"destination\": \"platform=iOS Simulator,name=iPhone 16 Pro,OS=18.0\"}\n```\n\n### Release Configuration Testing\n```json\n{\"projectPath\": \"/path/to/MyApp.xcodeproj\", \"scheme\": \"MyApp\", \"configuration\": \"Release\"}\n```\n\n## Related Tools\n\n- xcodebuild-build: Build before testing\n- xcodebuild-get-details: Get full test logs (use with testId)\n- simctl-list: See available test simulators\n";
export declare const XCODEBUILD_TEST_DOCS_MINI = "Run Xcode tests with filtering. Use rtfm({ toolName: \"xcodebuild-test\" }) for docs.";
//# sourceMappingURL=xcodebuild-test.d.ts.map