Ranchero-Software / NetNewsWire

RSS reader for macOS and iOS.
https://netnewswire.com/
MIT License
8.42k stars 534 forks source link

Switch to Swift testing #4333

Open brentsimmons opened 3 months ago

ankushkushwaha commented 3 months ago

Hi @brentsimmons can you please provide more description, for example what is the plan? which modules/classes we can start first?

brentsimmons commented 3 months ago

I have no plan yet. :)

ankushkushwaha commented 3 months ago

Oh okay, then we can postpone this.

DandyLyons commented 2 months ago

@ankushkushwaha , I would love to work on this issue.

I recently added Swift Testing to 2 packages.

Honestly, it shouldn't matter very much where we start since converting one test from XCTest to Swift Testing doesn't change the API, and therefore shouldn't break any other tests.

But I think the Parser module is a good place to start, since it's a very well understood problem space with lots of resources.

However it is worth noting that Swift Testing, is Swift 6+ only. So on my projects, I have to use a Package@swift-6.0.swift in order to use Swift Testing. This may be less of an issue after Xcode 16 officially comes out next week and more people have the Swift 6 compiler by default.

Just to highlight potential benefits, I found a ton of code reuse on tests here: https://github.com/Ranchero-Software/NetNewsWire/blob/main/Modules/Parser/Tests/ParserTests/HTMLMetadataTests.swift

There are 12 tests, but with Swift Testing we only need about 3. We could reduce tests using parameterized testing. There could be 3 tests, parseSite, performance and loadImage, and these tests could be reused for each website.

ankushkushwaha commented 2 months ago

Okay, sounds interesting to me. @brentsimmons is the correct person to give permission to move forward for this task :)

brentsimmons commented 2 months ago

It‘s going to be a while before we start this — we’re working on the 6.2 milestone and using Xcode 15.4 for now.

DandyLyons commented 2 months ago

Cool. @ me whenever you're ready. I'd love to work on this.