swift-testing
swift-testing
is a modern, open-source testing library for Swift with powerful
and expressive capabilities. It gives developers more confidence with less code:
@Test func helloWorld() {
#expect("hello" != "world")
}
Important
This package is under active, ongoing development. Its contents, including all interfaces and implementation details, are experimental and are subject to change or removal without notice.
We welcome feedback and ideas from the Swift community. Please join us in the Swift forums and let us know what you think!
Feature overview
Flexible test organization
Define test functions almost anywhere with a single attribute and group related tests into hierarchies using Swift's type system.
Customizable metadata
Dynamically enable or disable tests depending on runtime conditions, categorize tests using tags, and associate bugs directly with the tests that verify their fixes or reproduce their problems.
Scalable execution
Automatically parallelize tests in-process, integrate seamlessly with Swift concurrency, and parameterize test functions across wide ranges of inputs.
Supported platforms
The table below describes the current level of support that swift-testing
has
for various platforms:
Platform | CI Status | Support Status |
---|---|---|
macOS | Supported | |
iOS | Supported | |
watchOS | Supported | |
tvOS | Supported | |
Ubuntu 22.04 | Supported | |
Windows | Pending support for macros |
Documentation
The detailed documentation for swift-testing
can be found on the
Swift Package Index.
Here, you can delve into comprehensive guides, tutorials, and API references to
make the most out of swift-testing
.
Getting started
swift-testing
is under active development. We are working to integrate it with
the rest of the Swift ecosystem, but you can try it out today by following the
steps in our
Getting Started
article.