can I use xctest with swift testing
Asked on 01/20/2025
1 search
Yes, you can use XCTest with Swift testing. Swift testing is a modern testing framework that can coexist with XCTest in the same project. This allows you to incrementally migrate your tests from XCTest to Swift testing if desired. Swift testing provides a different approach to writing tests, using macros like expect
and require
instead of the many assertion functions provided by XCTest. It also supports traits for specifying information per test or suite and takes advantage of Swift concurrency for parallelization.
For more details on how Swift testing and XCTest relate to each other, you can refer to the session Meet Swift Testing (17:35).

Platforms State of the Union
Discover the newest advancements on Apple platforms.

Go further with Swift Testing
Learn how to write a sweet set of (test) suites using Swift Testing’s baked-in features. Discover how to take the building blocks further and use them to help expand tests to cover more scenarios, organize your tests across different suites, and optimize your tests to run in parallel.

Meet Swift Testing
Introducing Swift Testing: a new package for testing your code using Swift. Explore the building blocks of its powerful new API, discover how it can be applied in common testing workflows, and learn how it relates to XCTest and open source Swift.