swift-testing

Installation
SKILL.md

Swift Testing Framework: Basics

Guidance for starting with Swift Testing (Testing framework) and writing clear, macro-driven tests.

Core Concepts

  • Import Testing to unlock macros; tests are plain functions annotated with @Test.
  • Name tests freely; XCTest's test name prefix has no meaning in Swift Testing. Use @Test("Display Name") to set the navigator title.
  • #expect is the primary assertion; pass a boolean expression to assert truthy outcomes.
  • Assert one behaviour per test function. Split a test that checks unrelated behaviours.
  • Async/throwing tests are supported via async/throws on the test function.
  • Swift Testing and XCTest run side by side in the same test target. A project that still holds XCTest tests is a supported end state.
  • Convert an existing XCTest target in stages when one change would be too large to review or to bisect. Give the staged order, one class or small batch per stage. Keep the target green between stages.
  • Swift Testing covers unit and integration tests. It provides no UI-automation API and no performance-measurement API. Keep XCUITest tests and XCTest measure performance tests on XCTest.

Example: Simple Test

import Testing
Installs
12
Repository
mintuz/skills
GitHub Stars
24
First Seen
Jan 24, 2026
swift-testing — mintuz/skills