swiftswift5swiftpm

Swift CLI --xunit-output option not working for me


I'm running Xcode 13.1 / Swift 5.5.1.

I have a package that has some unit tests in it; the Package.swift file uses swift-tools-version:5.5.

When I build & test my package from the CLI like this:

$ swift test --xunit-output results.xml

the tests run and pass (there's about 20 of them), but no XML output file is written to my current directory.

Am I using this command line option wrong, or does this feature just not work?


Solution

  • Found out this is a known bug in Swift Package Manager: https://bugs.swift.org/browse/SR-9133

    Until this issue is fixed, when using swift test, you must also parallelize tests with the --parallel option for the --xunit-output option to work.