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
- Read the toolchain:
swift --version,xcodebuild -version, orswift-tools-versioninPackage.swift. Gate anything inreferences/new-features.mdon it. - Check the test target's default actor isolation (
SWIFT_DEFAULT_ACTOR_ISOLATIONin build settings,.defaultIsolation(MainActor.self)inPackage.swift). It decides whether tests already run on the main actor. - See what the target already uses. New tests are Swift Testing. Existing XCTest stays as it is unless the task is a migration.