CheckOps
Swift Testing
Swift Testing is Apple's open-source (Apache-2.0) testing library for Swift, using @Test and #expect macros, parameterised tests, traits and parallel execution, included in Xcode 16 and Swift 6 toolchains.
Latest public signals
Not refreshed yet. Refresh reads the public site and, when the entry has a GitHub repository, the latest release.
Introduction
Swift Testing is a modern testing library for Swift, developed in the open by the Swift project. It is included with Swift 6 toolchains and Xcode 16 and later, and runs on Apple platforms, Linux and Windows. It uses Swift macros to make tests concise and expressive, and is designed to coexist with XCTest in the same target, so teams can migrate gradually.
Tests are functions marked @Test, optionally grouped in types marked @Suite. The #expect macro captures the full expression, so failures show the values of each sub-expression, and #require stops a test when a precondition fails (also unwrapping optionals). Parameterised tests pass arguments: to run one function over many inputs, each reported separately. Traits customise behaviour: tags for organisation, .disabled, .enabled(if:), .bug(...), time limits and serialised execution. Tests run in parallel by default, including across async code with Swift concurrency. The repository’s most recent release tag was swift-6.4.2-RELEASE on 30 October 2026.
The source code is at swiftlang/swift-testing on GitHub under the Apache-2.0 licence, with about 2,200 stars; the most recent commit was on 11 November 2026.
Features
- Macro-based assertions:
#expectand#requirewith rich failure output. - Parameterised tests:
arguments:for data-driven tests. - Traits and tags: Conditions, time limits, bug links and tags.
- Parallel by default: Built on Swift concurrency.
Pros
- Free to use: Open source under the Apache-2.0 licence, so the core tool costs nothing to use.
- Actively maintained: The repository had commits as recent as 11 November 2026.
Cons
- No UI testing: Use XCTest/XCUITest for UI automation.
- Newer ecosystem: Some tools and libraries still assume XCTest.
Usage and Links (Example)
import Testing
@testable import Shop
@Suite struct PricingTests {
@Test func appliesDiscount() {
#expect(Pricing.apply(100, percent: 10) == 90)
}
@Test("Discounts never exceed price", arguments: [0, 10, 50, 100])
func neverExceedsPrice(percent: Int) {
#expect(Pricing.apply(100, percent: percent) <= 100)
}
@Test func parsesOrder() throws {
let order = try #require(Order(json: sampleJSON))
#expect(order.items.count == 2)
}
}
swift test
Resources:
Pricing
Swift Testing is free and open source under the Apache-2.0 licence.
Recommended for?
- Swift developers on Xcode 16+ or Swift 6 starting new test suites.
- Server-side and cross-platform Swift projects on Linux or Windows.
Conclusion
Swift Testing is the future of unit testing in Swift, expressive, parallel and cross-platform, while XCTest remains for UI tests.
Alternatives
Other tools on CheckOps that cover similar ground. Open a page, or compare one with Swift Testing side by side.
XXCTestXCTest is Apple's testing framework for unit, performance and UI tests in Xcode projects across Apple platforms, with assertions, expectations for async code, performance metrics and code coverage.Compare with Swift Testing
NNimbleNimble is an Apache-2.0 matcher framework for Swift and Objective-C, offering expressive expect(...).to(...) assertions and asynchronous toEventually expectations, used with XCTest or Quick.Compare with Swift Testing
SSnapshotTesting (Point-Free)SnapshotTesting is Point-Free's MIT-licensed snapshot testing library for Swift, snapshotting views, view controllers and any value as images, text, JSON and more, with XCTest and Swift Testing support.Compare with Swift Testing
VViewInspectorViewInspector is an MIT-licensed library for unit testing SwiftUI views at runtime, letting tests traverse the view hierarchy, read values and trigger actions such as button taps.Compare with Swift Testing
XXCUITestA test automation framework for iOS applications, part of the XCTest framework.Compare with Swift Testing
AAppiumCross-platform automation framework for all kinds of apps, built on top of the W3C WebDriver protocol.Compare with Swift Testing