modernize-tests
Modernize test suites to use modern Swift Testing features or migrate from XCTest.
Skill by guillevc
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/guillevc-modernize-tests
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: testing
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/modernize-tests
What's inside
- Skill name
modernize-tests- Description
- Modernize test suites to use modern Swift Testing features or migrate from XCTest.
- License
- MIT
- Instructions
- 242 lines in SKILL.md · view on GitHub
Files (1)
- SKILL.md
SKILL.md (first lines)
# Modernize Tests
Test modernization refers to two potential actions: migrating from XCTest to Swift Testing, and updating existing Swift Testing tests to use recommended patterns.
XCTests should be migrated to Swift Testing when possible. However, not all XCTests can be migrated to Swift Testing.
- UI tests (those that use XCUIAutomation) cannot be written with Swift Testing, and must remain XCTests.
- XCTests that use the `measure { ... }` family of APIs for performance measurement cannot be migrated. However, other test methods within an XCTestCase that do not use XCTest performance APIs can be migrated.
## Migration Reference
### Imports
Replace `import XCTest` with `import Testing`. A file can import both if it contains mixed test content during incremental migration.
When removing `import XCTest`, check whether the file uses Foundation types (URL, CharacterSet, ProcessInfo, Data, etc.). XCTest re-exports Foundation, so add `import Foundation` if needed.
### Test Classes to Suites
Remove `XCTestCase` inheritance. Prefer structs over classes:
- `final class FoodTruckTests: XCTestCase { ... }` -> `struct FoodTruckTests { ... }`
### Move setUp/tearDown code to init/deinit
Replace `override func setUp()` with `init()` (can be `async throws`). Replace `override func tearDown()` with `deinit`. If `deinit` is needed, use
`actor` or `final class` instead of `struct` (since structs have no `deinit`). Change stored properties to not use implicitly-unwrapped optional
types, and move their initial assignment from `setUp` to either be initialized inline or, if the initialization is complex, in an initializer.
```
struct MyTests {
var fixture = Fixture()
mutating func `Fixture behaves as expected`() {
#expect(fixture.doSomething())
}
}
```
Avoid pulling instance variables into function bodies; this can cause noise. Swift Testing reinvokes the initializer fresh before each test runs.
If the test mutates an instance variable with value semantics, you may need to mark the test function `mutating`.
### Test Methods
Replace the `test` name prefix with the `@Test` attribute. If the resulting test name includes multiple camelCase words,
use a raw identifier with the test name in sentence case.
- `func testEngineDoesNotStall() { ... }` -> `@Test func `Engine does not stall`() { ... }`
- `func testIgnition() { ... }` -> `@Test func ignition() { ... }`
Test functions can be `async`, `throws`, or `async throws`, and can be isolated to a global actor with `@MainActor`.
### Assertions to Expectations
When migrating a test from XCTest to Swift Testing, apply these mappings:
`XCTAssert(x)`, `XCTAssertTrue(x)` -> `#expect(x)`
`XCTAssertFalse(x)` -> `#expect(!x)`
`XCTAssertNil(x)` -> `#expect(x == nil)`
`XCTAssertNotNil(x)` -> `#expect(x != nil)`
`XCTAssertEqual(x, y)` -> `#expect(x == y)`
`XCTAssertNotEqual(x, y)` -> `#expect(x != y)`
`XCTAssertIdentical(x, y)` -> `#expect(x === y)`
`XCTAssertNotIdentical(x, y)` -> `#expect(x !== y)`
`XCTAssertGreaterThan(x, y)` -> `#expect(x > y)`
`XCTAssertGreaterThanOrEqual(x, y)` -> `#expect(x >= y)`
`XCTAssertLessThanOrEqual(x, y)` -> `#expect(x <= y)`
`XCTAssertLessThan(x, y)` -> `#expect(x < y)`
`try XCTUnwrap(x)` -> `try #require(x)`
There is no direct equivalent for `XCTAssertEqual(_:_:accuracy:)`; use floating point math directly.
### Errors
When the error type is `Equatable` and the exact value is known, prefer to check the specific error value.
```
XCTAssertThrowsError(try f())
```
->
```
#expect(throws: (any Error).self) {
try f()
}
```
```
XCTAssertThrowsError(try f()) { error in
XCTAssertEqual(error, specificError)
}
```
->
```
#expect(throws: specificError) {
try f()
}
```
```
XCTAssertThrowsError(try f()) { error in
// Check error
}
```
->
```
let error = #expect(throws: (any Error).self) {
try f()
}
// Check error
```
```
XCTAssertNoThrow(try f())
```
->
```
#expect(throws: Never.self) {
try f()
}
```
### continueAfterFailureFrom guillevc/skills, MIT.
More from guillevc/skills
- 0.570score
audit-xcode-security-settings
guillevc
Audit and enable security-oriented Xcode build settings.
SkillAFreshness: AClaude Code +9 - 0.567score
uikit-app-modernization
guillevc
Modernizes UIKit apps for multi-window environments by replacing legacy shared-state APIs with context-appropriate modern alternatives.
SkillAFreshness: AClaude Code +9 - 0.567score
adopt-c-bounds-safety
guillevc
Guide for the C -fbounds-safety language extension.
SkillAFreshness: AClaude Code +9 - 0.566score
swiftui-whats-new-27
guillevc
New SwiftUI APIs, behaviors, and deprecations introduced in the 2027 OS releases (iOS 27, macOS 27, watchOS 27, tvOS 27, visionOS 27).
SkillAFreshness: AClaude Code +9 - 0.560score
swiftui-specialist
guillevc
Authoritative SwiftUI best practices from Apple.
SkillAFreshness: AClaude Code +9 - 0.558score
device-interaction
guillevc
Verify iOS app behavior on device or simulator via screenshots, UI hierarchy, and touch interactions.
SkillAFreshness: AClaude Code +9 - 0.518score
simple-english
guillevc
Rewrite or write English at a CEFR level (default B1) so non-proficient readers understand it.
SkillBFreshness: BClaude Code +9 - 0.479score
swift-factory-di
guillevc
MUST USE for questions about the Swift Factory dependency injection library by hmlongco, also called FactoryKit.
SkillCFreshness: CClaude Code +9 - 0.474score
audit
guillevc
Audit code against the living spec (ADRs and the glossary) and let the human resolve each contradiction.
SkillCFreshness: CClaude Code +9 - 0.474score
2-commit-fast
guillevc
Fast auto-commit: analyzes staged git changes and commits with an intelligent conventional commit message — no confirmation needed.
SkillCFreshness: CClaude Code +9 - 0.474score
record
guillevc
Write a resolved fact into the living spec (a glossary term or an ADR) and keep it coherent.
SkillCFreshness: CClaude Code +9 - 0.474score
develop
guillevc
Take a unit of work from fuzzy idea to shipped, on one loop.
SkillCFreshness: CClaude Code +9
Signals
- Stars
- 0
- Forks
- 0
- Open issues
- 0
- Last commit (this folder)
- Oct 3, 2026 (25 days ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/guillevc/skills
- Website
- skills.sh/guillevc/skills
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from guillevc
- 0.570score
audit-xcode-security-settings
guillevc
Audit and enable security-oriented Xcode build settings.
SkillAFreshness: AClaude Code +9 - 0.567score
uikit-app-modernization
guillevc
Modernizes UIKit apps for multi-window environments by replacing legacy shared-state APIs with context-appropriate modern alternatives.
SkillAFreshness: AClaude Code +9 - 0.567score
adopt-c-bounds-safety
guillevc
Guide for the C -fbounds-safety language extension.
SkillAFreshness: AClaude Code +9 - 0.566score
swiftui-whats-new-27
guillevc
New SwiftUI APIs, behaviors, and deprecations introduced in the 2027 OS releases (iOS 27, macOS 27, watchOS 27, tvOS 27, visionOS 27).
SkillAFreshness: AClaude Code +9 - 0.560score
swiftui-specialist
guillevc
Authoritative SwiftUI best practices from Apple.
SkillAFreshness: AClaude Code +9 - 0.558score
device-interaction
guillevc
Verify iOS app behavior on device or simulator via screenshots, UI hierarchy, and touch interactions.
SkillAFreshness: AClaude Code +9
Cite this page
modernize-tests skill. Agent Mart. https://agentmart.dev/skills/guillevc-modernize-tests (last updated 2026-10-24)