Top AI Repos — open-source AI, indexed and scored
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
A modern, expressive testing package for Swift
| Date | Stars |
|---|---|
| 2026-07-24 | 2155 |
| 2026-07-25 | 2155 |
| 2026-07-28 | 2155 |
| 2026-07-30 | 2155 |
| 2026-08-06 | 2155 |
Today
— stars today
This week
— stars this week
This month
— stars this month
Momentum
15.0
growth rate 0.00%/day
# Swift Testing
<!--
This source file is part of the Swift.org open source project
Copyright (c) 2024 Apple Inc. and the Swift project authors
Licensed under Apache License v2.0 with Runtime Library Exception
See https://swift.org/LICENSE.txt for license information
See https://swift.org/CONTRIBUTORS.txt for Swift project authors
-->
Swift Testing is a package with expressive and intuitive APIs that make testing
your Swift code a breeze.
[](https://github.com/swiftlang/swift-testing/actions/workflows/main_using_main.yml)
[](https://github.com/swiftlang/swift-testing/actions/workflows/main_using_release.yml)
## Feature overview
### Clear, expressive API
Swift Testing has a clear and expressive API built using macros, so you can
declare complex behaviors with a small amount of code. The `#expect` API uses
Swift expressions and operators, and captures the evaluated values so you can
quickly understand what went wrong when a test fails.
```swift
import Testing
@Test func helloWorld() {
let greeting = "Hello, world!"
#expect(greeting == "Hello") // Expectation failed: (greeting → "Hello, world!") == "Hello"
}
```
### Custom test behaviors
You can customize the behavior of tests or test suites using traits specified in
your code. Traits can describe the runtime conditions for a test, like which
device a test should run on, or limit a test to certain operating system
versions. Traits can also help you use continuous integration effectively by
specifying execution time limits for your tests.
```swift
@Test(.enabled(if: AppFeatures.isCommentingEnabled))
func videoCommenting() async throws {
let video = try #require(await videoLibrary.video(named: "A Beach"))
#expect(video.comments.contains("So picturesque!"))
}
```
### Easy and flexible organization
Swift Testing provides many ways to keep your tests organized. Structure
related tests using a hierarchy of groups and subgroups. Apply tags to flexibly
manage, edit, and run tests with common characteristics across your test suite,
like tests that target a specific device or use a specific module. You can also
give tests a descriptive name so you know what they’re doing at a glance.
```swift
@Test("Check video metadata",
.tags(.metadata))
func videoMetadata() {
let video = Video(fileName: "By the Lake.mov")
let expectedMetadata = Metadata(duration: .seconds(90))
#expect(video.metadata == expectedMetadata)
}
```
### Scalable coverage and execution
Parameterized tests help you run the same test over a sequence of values so you
can write less code. And all tests integrate seamlessly with Swift Concurrency
and run in parallel by default.
```swift
@Test("Continents mentioned in videos", arguments: [
"A Beach",
"By the Lake",
"Camping in the Woods"
])
func mentionedContinents(videoName: String) async throws {
let videoLibrary = try await VideoLibrary()
let video = try #require(await videoLibrary.video(named: videoName))
#expect(video.mentionedContinents.count <= 3)
}
```
### Cross-platform support
Swift Testing is included in officially-supported Swift toolchains, including
those for Apple platforms, Linux, and Windows. To use the library, import the
`Testing` module:
```swift
import Testing
```
You don't need to declare a package dependency to use Swift Testing. It's
developed as open source and discussed on the
[Swift Forums](https://forums.swift.org/c/development/swift-testing/103)
so the very best ideas, from anywhere, can help shape the future of testing in
Swift.
The table below describes the current level of support that Swift Testing has
for various platforms:
| **Platform**Excerpt of 6,201 characters
Read on GitHub875
204
23
Yuta Saito · @Goodnotes
22
20
18
17
16
15
13
13
Brian Croom · Apple
8
7
6
6
5
5
5
5
Sven A. Schmidt · finestructure
4
Would you bet a product on this? Bounded 0–100 and slow moving.
matched fp:b07718169cd7fa0c, topic:testing