swift-testing

Installation
SKILL.md

Swift Testing

How a Swift test is written. What to test is the repo's testing-policy when it ships one. For the red-green-refactor loop, use tdd; for the code under test, swift-ios.

Swift Testing ships new APIs several times a year, and most training data and blog posts are XCTest. Your instincts reskin XCTest. The rules below exist to stop that. Trust the installed toolchain over memory and over Apple's docs, which lag behind it.

Before you write

  1. Read the toolchain: swift --version, xcodebuild -version, or swift-tools-version in Package.swift. Gate anything in references/new-features.md on it.
  2. Check the test target's default actor isolation (SWIFT_DEFAULT_ACTOR_ISOLATION in build settings, .defaultIsolation(MainActor.self) in Package.swift). It decides whether tests already run on the main actor.
  3. See what the target already uses. New tests are Swift Testing. Existing XCTest stays as it is unless the task is a migration.
Installs
3
First Seen
8 days ago