Skip to content
Development
Skill

/ios-testing-patterns

XCTest and XCUITest execution workflows and flaky test detection patterns

From plugin
xclaude-plugin
1828 skills2 MCP
Install
$ npx -y skills add conorluddy/xclaude-plugin --skill ios-testing-patterns --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/ios-testing-patterns

Context preview

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

XCTest and XCUITest execution workflows and flaky test detection patterns

SKILL.md

ios-testing-patterns.SKILL.md
name: ios-testing-patterns
description: XCTest and XCUITest execution workflows and flaky test detection patterns
version: 0.0.1
token_cost: ~40

iOS Testing Patterns Skill

**Comprehensive guide to XCTest and XCUITest execution, analysis, and flaky test detection**

Overview

This skill provides patterns and workflows for executing iOS tests using XCTest and XCUITest frameworks. It covers test execution strategies, result analysis, flaky test detection, and troubleshooting common test failures.

**Use this skill when:**

  • Running unit tests or UI tests
  • Analyzing test failures
  • Detecting and debugging flaky tests
  • Optimizing test execution performance
  • Setting up CI/CD test pipelines

Quick Reference

| Task | Operation | Key Parameters | | ------------------ | --------- | ---------------------- | | Run all tests | `test` | scheme, destination | | Run specific test | `test` | scheme, only_testing | | Skip tests | `test` | scheme, skip_testing | | Use test plan | `test` | scheme, test_plan | | Parallel execution | `test` | destination (multiple) |

When to Use This Skill

**Use ios-testing-patterns when:**

  • Executing XCTest unit tests
  • Running XCUITest UI automation tests
  • Investigating test failures
  • Detecting intermittent test failures (flaky tests)
  • Analyzing test performance and execution time
  • Setting up test schemes and test plans
  • Configuring parallel test execution
  • Debugging test-specific simulator issues

**Related Skills:**

  • **xcode-workflows**: For general build and test operations
  • **simulator-workflows**: For managing test simulators
  • **ui-automation-workflows**: For UI test interaction patterns

Key Concepts

XCTest vs XCUITest

**XCTest (Unit/Integration Tests):**

  • Fast execution (milliseconds to seconds)
  • Tests individual components in isolation
  • Direct access to app internals
  • No UI interaction required
  • Runs in same process as app code

**XCUITest (UI Tests):**

  • Slower execution (seconds to minutes)
  • Tests user-facing workflows
  • Black-box testing (no app internals)
  • Requires simulator/device UI
  • Runs in separate process

Test Execution Strategies

**Sequential Execution:**

  • Tests run one after another
  • Predictable, repeatable results
  • Slower overall execution
  • Better for debugging

**Parallel Execution:**

  • Tests run simultaneously on multiple simulators
  • Faster overall execution
  • Requires more system resources
  • May expose race conditions

**Test Sharding:**

  • Split test suite across multiple destinations
  • Optimal for CI/CD pipelines
  • Reduces total execution time
  • Requires careful test isolation

Workflows

1. Running Unit Tests

**Basic Unit Test Execution:**

{
  "operation": "test",
  "scheme": "MyApp",
  "destination": "platform=iOS Simulator,name=iPhone 15,OS=18.0"
}

**Note:** The destination parameter now supports auto-resolution! You can omit the OS version (e.g., `"platform=iOS Simulator,name=iPhone 15"`) and the tool will automatically select the latest available OS version for that device.

**Run Specific Test Class:**

{
  "operation": "test",
  "scheme": "MyApp",
  "destination": "platform=iOS Simulator,name=iPhone 15,OS=18.0",
  "options": {
    "only_testing": ["MyAppTests/NetworkTests"]
  }
}

**Run Specific Test Method:**

{
  "operation": "test",
  "scheme": "MyApp",
  "destination": "platform=iOS Simulator,name=iPhone 15,OS=18.0",
  "options": {
    "only_testing": ["MyAppTests/NetworkTests/testAPIRequest"]
  }
}

2. Running UI Tests

**Basic UI Test Execution:**

{
  "operation": "test",
  "scheme": "MyAppUITests",
  "destination": "platform=iOS Simulator,name=iPhone 15"
}

**UI Tests with Specific Device:**

{
  "operation": "test",
  "scheme": "MyAppUITests",
  "destination": "platform=iOS Simulator,name=iPad Pro (12.9-inch)"
}

**UI Tests with Test Plan:**

{
  "operation": "test",
  "scheme": "MyApp",
  "destination": "platform=iOS Simulator,name=iPhone 15",
  "options": {
    "test_plan": "SmokeTests"
  }
}

3. Parallel Test Execution

**Multiple Destinations:**

Run tests on multiple simulators simultaneously:

{
  "operation": "test",
  "scheme": "MyApp",
  "destination": [
    "platform=iOS Simulator,name=iPhone 15",
    "platform=iOS Simulator,name=iPhone SE (3rd generation)"
  ],
  "options": {
    "parallel": true
  }
}

**Parallel Test Benefits:**

  • Reduces total execution time
  • Tests across multiple device types
  • Exposes device-specific issues
  • Better CI/CD performance

**Parallel Test Considerations:**

  • Requires multiple simulators
  • Higher CPU/memory usage
  • May expose race conditions
  • Test isolation critical

4. Test Filtering

**Skip Specific Tests:**

{
  "operation": "test",
  "scheme": "MyApp",
  "destination": "platform=iOS Simulator,name=iPhone 15",
  "options": {
    "skip_testing": [
      "MyAppUITests/SlowTests",
      "MyAppTests/NetworkTests/testLargeDownload"
    ]
  }
}

**Run Only Fast Tests:**

{
  "operation": "test",
  "scheme": "MyApp",
  "destination": "platform=iOS Simulator,name=iPhone 15",
  "options": {
    "only_testing": ["MyAppTests/UnitTests"],
    "skip_testing": ["MyAppTests/UnitTests/testSlowOperation"]
  }
}

5. Test Result Analysis

**Success Response:**

{
  "success": true,
  "tests_run": 45,
  "tests_passed": 45,
  "tests_failed": 0,
  "execution_time": "12.4s",
  "scheme": "MyApp"
}

**Failure Response:**

{
  "success": false,
  "tests_run": 45,
  "tests_passed": 43,
  "tests_failed": 2,
  "failures": [
    {
      "test": "MyAppTests.LoginTests.testInvalidPassword",
      "message": "XCTAssertEqual failed: (\"error\") is not equal to (\"invalid\")",
      "file": "LoginTests.swift",
      "line": 42
    },
    {
      "test": "MyAppUITests.CheckoutTests.testPaymentFlow",
      "message": "Failed to fin
Read more
Ships withxclaude-plugin

Modular iOS development automation for Claude Code Build, test, and automate iOS apps through natural conversation with Claude. 8 workflow-specific MCP servers with 24 tools across Xcode, Simulator, and IDB. Enable only what you need.

Get the whole plugin

Other skills on xclaude-plugin.