Will `swift-testing` allow testing w/o XCode on macOS?

Context

In the past, I've discovered that, using Swift on Linux and Windows one only requires the toolchain… but on macOS, you are required to have the GB upon GB of Xcode — macSDK and iosSDK are not optional installs — simply to unit test your cross-platform Swift project with swift test. source

Question

Now with the eventual release of Swift 6 and swift-testing, I have a question! While the readme states swift-testing will work with XCTest — which I'm told is the reason why Xcode is required on macOS — it doesn't clearly state if running swift test while swift-testing is imported will still require Xcode on macOS. Will swift-testing finally allow me to develop cross-platform programs easily (read "without xcode") on macOS?

Would anyone here know the answer to this or know where I could find the answer to this?! Thank you!

The iOS SDK and simulators have been optional since Xcode 15, reducing initial download size to 3.17GB. It includes the macOS SDK, as you'd otherwise not be able to use any of the platform frameworks. Xcode 16 is currently even smaller, at 2.64GB. Whether it's a dependency for swift-testing I don't know.

I'm not sure who told you that, but it isn't accurate. Swift Testing works with XCTest in the sense that you can use both in a single test target. Swift Testing is not dependent on XCTest and runs entirely independently.

We are working to integrate Swift Testing into the Swift 6 toolchain. That work is not complete yet, but the main branch of Swift Package Manager is ready for it! If you add a dependency on the swift-testing package to your package and use a recent nightly build of Swift, you will be able to run Swift Testing tests using just swift test[1]. The output and behaviour when using swift test should be exactly the same as if you had run it with Xcode installed.


  1. On macOS, you may still need to install Xcode 16 in order to run swift test directly. With neither installed, you can manually run swift test from the toolchain by specifying an absolute path to /Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin or by adding that path to your $PATH environment variable. ↩︎

4 Likes

Oh!! That's miscommunication on my part. I mean that XCTest was the reason why Xcode was required … although this in of itself might also be incorrect. Thank you for your answer. This is great news!

1 Like