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
Testingto unlock macros; tests are plain functions annotated with@Test. - Name tests freely; use
@Test("Display Name")to set the navigator title. #expectis the primary assertion; pass a boolean expression to assert truthy outcomes.- Async/throwing tests are supported via
async/throwson the test function. - Works alongside XCTest in the same project.
Example: Simple Test
import Testing
func add(_ a: Int, _ b: Int) -> Int { a + b }