Tool assisted refactoring of tests using XCTestCase to use swift-testing macros

How unrealistic is the idea of a refactor command in Xcode (or whatever) that attempts to convert an XCTestCase to a type using swift-testing macros?

Having such a command may take much of the tedium out of the effort and rapidly increase adoption. When I look in my code bases, there are a large number of subclasses of XCTestCase containing usage of XCTAssert* that could be refactored fairly straightforwardly.

1 Like

You might find this lovely third-party tool created by @giginet helpful: swift-testing-revolutionary. It's designed to convert XCTest cases to swift-testing format–does not support all cases but it support a lot of them.

4 Likes

That looks sweet. Thanks for sharing this!

Thank you for introducing my product :smile:

Feel free to open an issue if you have any problems.

3 Likes

@giginet :pray:t2: thank you for this tool!

Just gave this a go on one of my projects. Took me all of 15 minutes to convert 32 tests. This is including the one time setup and figuring out how the tool works. (Probably 14 minutes of those 15 minutes, so a 'fixed cost'). Imagine applying this to 3200 tests... :rocket:

Note: I opened two minor issues for findings.