test-modernizer

Migrate XCTest suites to Swift Testing and modernize existing Swift Testing code.

25|1|Updated Feb 10, 2026
One-click install
npx skills add https://github.com/wisdom-in-a-nutshell/agents --skill test-modernizer-wisdom-in-a-nutshell
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: test-modernizer
Source: https://github.com/wisdom-in-a-nutshell/agents/tree/main/skills-source/external/test-modernizer
Command: npx skills add https://github.com/wisdom-in-a-nutshell/agents --skill test-modernizer-wisdom-in-a-nutshell

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Swift projects still rely on legacy XCTest patterns, and manually converting test classes, assertions, and asynchronous expectations to Swift Testing is error-prone and time-consuming. This Skill applies the correct mappings so migrated tests preserve their original behavior. ## Core Features & Use Cases - XCTest to Swift Testing Migration: Converts XCTestCase classes to struct-based suites, setUp/tearDown to init/deinit, and XCTAssert calls to #expect/#require macros. - Async and Skip Pattern Updates: Replaces XCTestExpectation with confirmation(), XCTSkip with trait-based disabling, and XCTExpectFailure with withKnownIssue. - Modernization of Existing Swift Testing Code: Converts camelCase test names to sentence-case raw identifiers, introduces parameterized tests with @Test(arguments:), and applies @Suite(.serialized) where shared state requires it. - Use Case: You inherit a Swift package with 40 XCTestCase classes. Ask the assistant to migrate them one class at a time, preserving continueAfterFailure semantics by converting assertions to try #require where needed. ## Quick Start Migrate the XCTest tests in my FoodTruckTests.swift file to Swift Testing.

Frequently Asked Questions about test-modernizer

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I migrate XCTest tests to Swift Testing?▼

Replace import XCTest with import Testing, convert XCTestCase classes to struct suites, change test-prefixed methods to @Test functions, and map XCTAssert calls to #expect or #require. Migrate one test class at a time since a file can mix both frameworks during migration.

How to convert XCTAssert assertions to Swift Testing macros?▼

Map XCTAssert to #expect, XCTAssertEqual to #expect(x == y), and try XCTUnwrap to try #require. When a test sets continueAfterFailure = false, convert all assertions to try #require and add throws to preserve halting behavior.

Can Swift Testing replace XCTestExpectation for async tests?▼

Yes, replace XCTestExpectation with fulfill() and await fulfillment(of:) using confirmation(). Pass an expectedCount range when the original expectation used expectedFulfillmentCount with assertForOverFulfill disabled.

When should XCTest not be migrated to Swift Testing?▼

Do not migrate UI automation tests using XCUI* APIs, since they cannot be represented in Swift Testing. Also skip migration when the user only wants new tests written from scratch or is debugging failures without requesting a conversion.

Why does my migrated Swift Testing suite behave differently than XCTest?▼

Swift Testing runs tests in parallel on arbitrary tasks, while XCTest ran synchronously on the main actor. Add @MainActor only where tests relied on main-actor isolation, and add @Suite(.serialized) when tests share mutable state.