Skip to content
Commitwise
Menu

Swift Testing

Apple's modern testing framework for Swift: @Test functions, #expect and #require checks, parameterized tests and traits.

Definition

Introduced with Xcode 16, Swift Testing replaces XCTestCase subclasses and XCTAssert functions for unit tests. #expect records a failure and shows the values involved; #require stops the test. Tests run in parallel by default, suites are structs with a fresh instance per test, and @Test(arguments:) reports each input separately. UI tests and performance tests still use XCTest.

In practice

@Test(arguments: ["", "a", "abc"]) runs one validation test three times, with three separate results.

Related terms

Esc

Type to search the whole site.