# Announcing SwiftQC: A Feature-Rich Testing Framework for Swift 6 with Stateful & Parallel Capabilities

**URL:** <https://forums.swift.org/t/announcing-swiftqc-a-feature-rich-testing-framework-for-swift-6-with-stateful-parallel-capabilities/81165>\
**Category:** Related Projects\
**Tags:** concurrency, swift, testing, property, swift-testing\
**Created:** [July 17, 2025, 3:58pm UTC](https://forums.swift.org/t/announcing-swiftqc-a-feature-rich-testing-framework-for-swift-6-with-stateful-parallel-capabilities/81165 "2025-07-17T15:58:37Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sheldon](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/sheldon/32/42149_2.png) [@Sheldon](https://forums.swift.org/u/Sheldon)\
**Post date:** [July 17, 2025, 3:58pm UTC](https://forums.swift.org/t/announcing-swiftqc-a-feature-rich-testing-framework-for-swift-6-with-stateful-parallel-capabilities/81165/1 "2025-07-17T15:58:37Z")

</div>

Hey everyone,

I'm excited to introduce **SwiftQC** , a property-based testing framework I built specifically for Swift 6+ and modern Swift development.

**Repository:** [https://github.com/Aristide021/SwiftQC](https://github.com/Aristide021/SwiftQC)  
**Documentation:** [Complete guides and examples](https://github.com/Aristide021/SwiftQC/tree/main/Documentation)

* * *

## **Why Property-Based Testing?**

As developers, we usually write tests by coming up with specific inputs and checking the outputs. SwiftQC automatically generates hundreds of test cases, and when failures occur, intelligently shrinks them to the minimal counterexample, often revealing edge cases you'd never think to test manually.

* * *

## **What SwiftQC Brings To The Table**

### **Complete Stateful Testing Engine**

Confidently test complex user flows and stateful APIs.\*\* SwiftQC's stateful engine lets you model your system's behavior, then automatically generates sequences of commands to find elusive, state-related bugs. When a test fails, its powerful **command sequence shrinker** pinpoints the minimal steps needed to reproduce the error, saving you hours of debugging.

### **Concurrent System Verification**

Built-in parallel testing runner helps discover race conditions and concurrency bugs by executing commands concurrently and detecting divergences from expected behavior.

### **Elegant, Composable Design**

- **Sendable-first architecture** built for Swift 6+ concurrency
- **Seamless integration** with Swift Testing's issue reporting system
- **Built on proven foundations** - leverages PointFree's excellent `swift-gen` for composable generators
- **Ergonomic `Arbitrary` protocol** makes most tests incredibly concise

* * *

## **Usage**

**Basic Property Testing:**

```swift
import SwiftQC
import Testing

@Test
func additionIsCommutative() async {
  await forAll("Integer addition is commutative") { (a: Int, b: Int) in
    #expect(a + b == b + a)
  }
}

```

**Custom Types:**

```swift
struct Point: Arbitrary, Sendable, Equatable {
    let x: Int, y: Int
    
    static var gen: Gen<Point> {
        zip(Int.gen, Int.gen).map(Point.init)
    }
    
    static var shrinker: any Shrinker<Point> {
        Shrinkers.map(
            from: Shrinkers.tuple(Shrinkers.int, Shrinkers.int),
            transform: Point.init,
            reverse: { ($0.x, $0.y) }
        )
    }
}

@Test
func pointDistanceIsCommutative() async {
    await forAll("Distance calculation is commutative") { (p1: Point, p2: Point) in
        #expect(distance(p1, p2) == distance(p2, p1))
    }
}

```

**Stateful Testing:**

```swift
// Define your state model
struct CounterModel: StateModel {
    typealias State = Int
    typealias SUT = MyCounter
    // ... command generation, state transitions, etc.
}

@Test
func counterMaintainsConsistency() async {
    let result = await stateful(
        "Counter behaves according to model",
        sutFactory: { MyCounter() }
    )
    // SwiftQC handles command sequence generation, execution,
    // divergence detection, and automatic shrinking
}

```

* * *

## **Rich Ecosystem Support**

SwiftQC provides `Arbitrary` conformances for extensive Swift standard library coverage:

- **Numeric types:** All integer and floating-point variants, including `Decimal` and `CGFloat`
- **Text processing:** `String`, `Character`, `Unicode.Scalar`
- **Collections:** `Array`, `Dictionary`, `Set`, `Optional`, `Result`
- **Foundation types:** `Date`, `Data`, `UUID`, and more

* * *

## **Getting Started**

**Installation:**

```swift
// Package.swift
.package(url: "https://github.com/Aristide021/SwiftQC.git", from: "1.0.0")

```

**Requirements:**

- Swift 6.0+
- Platforms: macOS 12+, iOS 13+, tvOS 13+, watchOS 6+
- Works with both Swift Testing and XCTest

**Explore the Examples:**

- [**BasicUsage**](https://github.com/Aristide021/SwiftQC/tree/main/Examples/BasicUsage) - Fundamentals and custom types
- [**StatefulExample**](https://github.com/Aristide021/SwiftQC/tree/main/Examples/StatefulExample) - State machine testing
- [**ParallelExample**](https://github.com/Aristide021/SwiftQC/tree/main/Examples/ParallelExample) - Concurrent system verification

Each example is a complete Swift package you can run immediately:  
`cd Examples/BasicUsage && swift test`

* * *

## **Community & Feedback**

I would greatly appreciate your feedback, contributions, and real-world testing. Please try it out and share your thoughts, whether through GitHub issues, discussions, or the forums.

---

<div class="post-metadata">

**Author:** ![Max\_Desiatov](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/max_desiatov/32/20654_2.png) [@Max\_Desiatov](https://forums.swift.org/u/Max_Desiatov)\
**Post date:** [July 17, 2025, 9:32pm UTC](https://forums.swift.org/t/announcing-swiftqc-a-feature-rich-testing-framework-for-swift-6-with-stateful-parallel-capabilities/81165/2 "2025-07-17T21:32:17Z")

</div>

This looks amazing, I'm very glad to see more libraries supporting property-based testing in Swift!

Minor nit: for some reason `LICENSE` file is not detected as Apache 2.0 on GitHub? Usually it's best to use their auto-generated template for detection to work, and any notes to be added in `README.md` or separate files.

---

<div class="post-metadata">

**Author:** ![Sheldon](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/sheldon/32/42149_2.png) [@Sheldon](https://forums.swift.org/u/Sheldon)\
**Post date:** [July 18, 2025, 1:18am UTC](https://forums.swift.org/t/announcing-swiftqc-a-feature-rich-testing-framework-for-swift-6-with-stateful-parallel-capabilities/81165/3 "2025-07-18T01:18:45Z")

</div>

> [@Max\_Desiatov](#):
>
> This looks amazing, I'm very glad to see more libraries supporting property-based testing in Swift!
> 
> Minor nit: for some reason `LICENSE` file is not detected as Apache 2.0 on GitHub? Usually it's best to use their auto-generated template for detection to work, and any notes to be added in `README.md` or separate files.

Thanks! Can't wait to see how people will utilize this for testing stateful and parallel code in Swift.

Thanks for the heads up on the LICENSE detection! I just fixed it, should show up as Apache 2.0 now.

Appreciate the feedback!

---

<div class="post-metadata">

**Author:** ![hassila](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/hassila/32/22647_2.png) [@hassila](https://forums.swift.org/u/hassila)\
**Post date:** [July 18, 2025, 8:25am UTC](https://forums.swift.org/t/announcing-swiftqc-a-feature-rich-testing-framework-for-swift-6-with-stateful-parallel-capabilities/81165/4 "2025-07-18T08:25:56Z")

</div>

Interesting!

Could probably drop the dependency on swift-atomics and use the built-in ones as you target a modern toolchain only?

---

<div class="post-metadata">

**Author:** ![grynspan](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/grynspan/32/15315_2.png) [@grynspan](https://forums.swift.org/u/grynspan)\
**Post date:** [July 20, 2025, 1:52pm UTC](https://forums.swift.org/t/announcing-swiftqc-a-feature-rich-testing-framework-for-swift-6-with-stateful-parallel-capabilities/81165/5 "2025-07-20T13:52:07Z")

</div>

Fascinating! I'd encourage you to put together a short presentation to share with the Testing Workgroup. If that sounds worthwhile, DM me and I'll make sure you're added to our upcoming schedule.

---

<div class="post-metadata">

**Author:** ![Sheldon](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/sheldon/32/42149_2.png) [@Sheldon](https://forums.swift.org/u/Sheldon)\
**Post date:** [July 23, 2025, 11:28pm UTC](https://forums.swift.org/t/announcing-swiftqc-a-feature-rich-testing-framework-for-swift-6-with-stateful-parallel-capabilities/81165/6 "2025-07-23T23:28:21Z")

</div>

> [@hassila](#):
>
> Could probably drop the dependency on swift-atomics and use the built-in ones as you target a modern toolchain only?

Good catch, thanks for the heads up! The swift-atomics dependency is only used in the test suite (for things like ManagedAtomic). I’ll switch the tests to use the built-in atomics in the near future.
