swhitty
(Simon Whitty)
September 9, 2024, 6:21am
1
I recently adopted Swift Testing in FlyingFox for all unit tests and was really impressed with the performance:
Swift Testing
✔ Test run with 354 tests passed after 1.359 seconds.
XCTest
Executed 352 tests, with 0 failures (0 unexpected) in 7.796 (7.815) seconds
These results are from running on GitHub Actions .
Thank you to the team for such a fundamental change — can't wait to see where the future goes from here.
7 Likes
0xTim
(Tim)
September 9, 2024, 9:20am
2
I'm guessing you weren't parallelising your tests with XCTest? That would explain the huge speed up but I'd love to be proven wrong!
swhitty
(Simon Whitty)
September 9, 2024, 10:05am
3
I wasn't but are you able to parallelise with % swift test
?
With xcodebuild parallelisation its marginally faster (5.8s
) but it is also difficult to get an elapsed time output;
% xcodebuild -scheme FlyingFox-Package -destination 'platform=macOS' -parallel-testing-enabled YES test-without-building
...
xcodebuild[4830:5223951] [MT] IDETestOperationsObserverDebug: 5.868 elapsed -- Testing started completed.
grynspan
(Jonathan Grynspan)
September 9, 2024, 11:28am
4
To parallelize XCTest using Swift Package Manager, simply pass the --parallel
option. Note that XCTest parallelizes by spawning multiple processes while Swift Testing uses Swift concurrency, so the pros and cons are different.
1 Like
swhitty
(Simon Whitty)
September 9, 2024, 12:09pm
5
using % swift test --parallel
the XCTests are around 3s
1 Like
grynspan
(Jonathan Grynspan)
September 9, 2024, 4:16pm
6
Hey, that's still more than 2x as fast. I'll take that win.
4 Likes
0xTim
(Tim)
September 9, 2024, 10:35pm
7
No Objective-C for the win