# Test

> Run unit and UI tests for the iOS project. Use when you need to execute tests and validate code quality.

- Skill: `duboc/test` (Agent Skill)
- Install (CLI): `npx skillmds@latest add duboc/test`
- Raw SKILL.md: https://api.skillmd.com/api/skills/duboc/test/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: duboc (https://skillmd.com/u/duboc)
- Updated: 2026-09-22
- Page: https://skillmd.com/skills/duboc/test

---


# Run Tests

Execute tests for the iOS project.

## Test Commands

### Run All Tests
```bash
xcodebuild test \
  -scheme MyApp \
  -destination 'platform=iOS Simulator,name=iPhone 15' \
  -resultBundlePath TestResults.xcresult
```

### Run Specific Test Target
```bash
xcodebuild test \
  -scheme MyApp \
  -only-testing:MyAppTests \
  -destination 'platform=iOS Simulator,name=iPhone 15'
```

### Run Specific Test Class
```bash
xcodebuild test \
  -scheme MyApp \
  -only-testing:MyAppTests/MyViewModelTests \
  -destination 'platform=iOS Simulator,name=iPhone 15'
```

### Run Specific Test Method
```bash
xcodebuild test \
  -scheme MyApp \
  -only-testing:MyAppTests/MyViewModelTests/testInitialState \
  -destination 'platform=iOS Simulator,name=iPhone 15'
```

## Swift Package Tests
```bash
swift test
```

## Test Coverage

### Generate Coverage Report
```bash
xcodebuild test \
  -scheme MyApp \
  -destination 'platform=iOS Simulator,name=iPhone 15' \
  -enableCodeCoverage YES
```

### View Coverage
```bash
xcrun xccov view --report TestResults.xcresult
```

## Parallel Testing
```bash
xcodebuild test \
  -scheme MyApp \
  -parallel-testing-enabled YES \
  -parallel-testing-worker-count 4 \
  -destination 'platform=iOS Simulator,name=iPhone 15'
```

## Workflow
1. Identify test targets (unit tests, UI tests)
2. Run unit tests first (faster)
3. Run UI tests if unit tests pass
4. Report results with coverage

