modernize-tests

Installation
SKILL.md

Modernize Tests

Test modernization refers to two potential actions: migrating from XCTest to Swift Testing, and updating existing Swift Testing tests to use recommended patterns.

XCTests should be migrated to Swift Testing when possible. However, not all XCTests can be migrated to Swift Testing.

  • UI tests (those that use XCUIAutomation) cannot be written with Swift Testing, and must remain XCTests.
  • XCTests that use the measure { ... } family of APIs for performance measurement cannot be migrated. However, other test methods within an XCTestCase that do not use XCTest performance APIs can be migrated.

Migration Reference

Imports

Replace import XCTest with import Testing. A file can import both if it contains mixed test content during incremental migration.

When removing import XCTest, check whether the file uses Foundation types (URL, CharacterSet, ProcessInfo, Data, etc.). XCTest re-exports Foundation, so add import Foundation if needed.

Test Classes to Suites

Remove XCTestCase inheritance. Prefer structs over classes:

Installs
33
GitHub Stars
7
First Seen
13 days ago
modernize-tests — tartinerlabs/skills