← ClaudeAtlas

modernize-testslisted

Modernize test suites to use modern Swift Testing features or migrate from XCTest.
tartinerlabs/skills · ★ 7 · Testing & QA · score 71
Install: claude install-skill tartinerlabs/skills
# 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 typ