# test-modernizer

Migrates XCTest suites to Swift Testing and updates assertions to modern syntax. Useful during Swift test refactoring.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 696 installs · ★ 352
- Author: superagents-lab
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/superagents-lab/xcode27-skills/tree/HEAD/test-modernizer/SKILL.md
- Updated: 2026-06-09
- HTML: https://affpapa.org/en/nevibecode/skills/test-modernizer

## What it does

The skill updates test suites from XCTest to Swift Testing. It turns `XCTestCase` classes into structs or actors, maps `setUp` and `tearDown` methods to `init` and `deinit`, and drops the `test` method prefix in favor of the `@Test` attribute.

Legacy assertion macros turn into `#expect` expressions, while unwrapping checks become `try #require`. When an existing suite relies on `continueAfterFailure = false`, the conversion swaps subsequent checks for throwing `try #require` calls to preserve early exit behavior. Because XCTest re-exports Foundation implicitly, the skill inserts `import Foundation` whenever types like `URL` or `Data` are detected in the file.

UI automation suites relying on `XCUI*` APIs are out of scope: Swift Testing cannot execute them.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add superagents-lab/xcode27-skills --skill test-modernizer -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/test-modernizer/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/test-modernizer/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add superagents-lab/xcode27-skills --skill test-modernizer -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/test-modernizer/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add superagents-lab/xcode27-skills --skill test-modernizer -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/test-modernizer/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install superagents-lab/xcode27-skills test-modernizer
```

2. **Manually: put the files in place**
- File: `.github/skills/test-modernizer/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add superagents-lab/xcode27-skills --skill test-modernizer -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/superagents-lab/xcode27-skills --path test-modernizer
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/test-modernizer/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add superagents-lab/xcode27-skills --skill test-modernizer -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/superagents-lab/xcode27-skills/tree/HEAD/test-modernizer/SKILL.md

## When to use it
- migrate XCTest test suites to Swift Testing structs
- convert XCTAssert assertions into #expect and #require checks
- replace XCTestExpectation handling with async confirmation blocks
- update conditional test skipping to @Test traits

## Example prompts
- Migrate this XCTestCase suite to Swift Testing
- Convert assertions in FoodTruckTests.swift to use #expect and #require
- Update these legacy unit tests to modern Swift Testing syntax

## Similar
- [axiom-testing](https://affpapa.org/en/nevibecode/skills/axiom-testing.md) — skill · 1300 installs
- [guide-swift-testing](https://affpapa.org/en/nevibecode/skills/guide-swift-testing.md) — skill · 427 installs
- [swift-testing-pro](https://affpapa.org/en/nevibecode/skills/swift-testing-pro.md) — skill · 10100 installs
- [performance-profiling](https://affpapa.org/en/nevibecode/skills/mengto-performance-profiling.md) — skill · 1400 installs
- [axiom-performance](https://affpapa.org/en/nevibecode/skills/axiom-performance.md) — skill · 1300 installs
- [ce-test-xcode](https://affpapa.org/en/nevibecode/skills/ce-test-xcode.md) — skill · 2900 installs

From the same set: [superagents-lab/xcode27-skills](https://affpapa.org/en/nevibecode/by/superagents-lab/xcode27-skills.md) — 7 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
