← ClaudeAtlas

swift-unit-testing-skilllisted

Design, write, migrate, and review Swift unit and integration tests using Swift Testing by default, with XCTest retained for UI automation, performance metrics, Objective-C interoperability, and legacy suites. Use for @Test, #expect, #require, parameterized tests, async tests, dependency injection, mocks/fakes, test plans, XCTest, XCUITest, TDD, flaky tests, and test architecture. Do not use UI-test polling or XCTest subclasses for ordinary new Swift unit tests, and do not introduce third-party snapshot frameworks unless the user requests one.
fal3/claude-skills-collection · ★ 18 · Testing & QA · score 79
Install: claude install-skill fal3/claude-skills-collection
# Swift Unit Testing Build deterministic tests around observable behavior. Prefer Swift Testing for new Swift unit and integration tests; choose XCTest only where it still provides the required runner or API. ## Compatibility baseline - Swift Testing requires Swift 6 / Xcode 16 or newer. It supports Apple platforms, Linux, and Windows. - XCTest remains appropriate for `XCUIApplication`, `XCTMetric`, Objective-C tests, and incremental maintenance of existing XCTest suites. - Swift Testing and XCTest can coexist in one test target. Do not mix `@Test` methods into an `XCTestCase` subclass. - State the app's actual deployment targets and CI Xcode version before recommending availability-sensitive traits or APIs. - Treat APIs first introduced after the installed SDK as future-cycle features and gate them explicitly. ## Select the test layer | Goal | Default | | --- | --- | | Pure Swift unit or integration behavior | Swift Testing | | Async/throws, parameterized cases, traits, tags | Swift Testing | | UIKit/SwiftUI end-to-end interaction | XCTest UI testing | | Runtime, CPU, memory, launch, or signpost metrics | XCTest performance APIs | | Objective-C test code or legacy suite | XCTest | Do not replace a unit test with a UI test. Keep network, database, clock, randomness, and notification boundaries injectable so unit tests remain fast and deterministic. ## Workflow 1. Identify the behavior and public boundary under test. 2. List failure cases, cancellation behavior, and st