modernize-tests
This skill guides you through modernizing test suites by migrating from XCTest to Swift Testing or refining existing Swift Testing implementations. It covers converting test classes to structs, replacing XCTest assertions with Swift Testing expectations, adapting setup/teardown logic, and handling async patterns—while noting that UI tests and performance measurement tests must remain as XCTests.
Modernize Tests helps you migrate XCTest code to Swift Testing and update existing Swift Testing tests to follow recommended patterns.
AI-generated summary based on this skill's SKILL.md
Decision gist · record as of 2026-07-26
Modernize Tests helps you migrate XCTest code to Swift Testing and update existing Swift Testing tests to follow recommended patterns. This skill guides you through modernizing test suites by migrating from XCTest to Swift Testing or refining existing Swift Testing implementations. It covers converting test classes to structs, replacing XCTest assertions with Swift Testing expectations, adapting setup/teardown logic, and handling async patterns—while noting that UI tests and performance measurement tests must remain as XCTests.
Use it when
- modernize-tests explains that Swift Testing replaces XCTest's XCTAssert family with the #expect macro.
- modernize-tests shows how to replace XCTest's setUp() and tearDown() methods with Swift Testing patterns.
Verify before relying
Read SKILL.md below before installing (1 file). Open directory: indexed for reading, not audited.
Install
tartinerlabs/skills/modernize-tests · repository language: Go
Open directory. Skills are indexed for reading, not audited. Review a skill's body before installing it.
Frequently asked questions
AI-generated answers based on this skill's SKILL.md and metadata
How do I migrate XCTest to Swift Testing?
modernize-tests guides you through converting your test suite from XCTest to Swift Testing. The main steps are: convert test classes to structs, replace XCTAssert calls with #expect macros, update setup/teardown using init and deinit, and adapt async test handling. Note that UI tests and performance measurement tests must remain as XCTests—Swift Testing currently supports unit tests only.
What's the difference between XCTAssert and Swift Testing #expect?
modernize-tests explains that Swift Testing replaces XCTest's XCTAssert family with the #expect macro. Instead of XCTAssertEqual(a, b), you write #expect(a == b). Swift Testing's #expect is more flexible, supports any Boolean expression, and provides better error messages. The skill covers converting all assertion types during migration.
How should I refactor test setup and teardown for Swift Testing?
modernize-tests shows how to replace XCTest's setUp() and tearDown() methods with Swift Testing patterns. Use init() for setup and deinit for teardown within your test struct. For more complex scenarios, the skill covers using @Test macro parameters and helper functions to manage test lifecycle and dependencies cleanly.
Can I convert XCUITest and performance tests to Swift Testing?
modernize-tests clarifies that UI tests and performance measurement tests must remain as XCTests. Swift Testing currently supports unit tests only. Focus migration efforts on your unit test suite, leaving XCUITest and performance tests unchanged.
How do I handle async tests when modernizing to Swift Testing?
modernize-tests covers async test refactoring by showing how Swift Testing's @Test macro naturally supports async/await. Replace XCTest's expectation-based async patterns with direct await calls in your test functions. The skill explains eliminating XCTestExpectation boilerplate and writing cleaner, more readable async test code.
What are the recommended patterns for Swift Testing best practices?
modernize-tests teaches Swift Testing best practices including: using structs instead of classes, organizing tests with descriptive names, leveraging @Test parameters for data-driven tests, and keeping assertions focused. The skill emphasizes readable error messages, proper async/await usage, and maintaining clear test structure as you modernize your suite.
SKILL.md
Rendered from the published skill. Quoted content, verbatim.
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
(truncated - see the full file via the links below)
File tree — 1 file
xcode-skills/modernize-tests/SKILL.md
Let your AI agent find skills like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 56,283 agent skills by what they can do, searchable in plain language.
wish › “Migrate existing XCTest code to Swift Testing framework”
Give your agent the search over MCP, or paste the wish link into any chat. No install? Search from any chat →
Related skills
Test Modernizer guides you through converting XCTest code to Swift Testing, covering class-to-struct transformations, assertion remapping, async pattern updates, and lifecycle method conversions. It provides clear migration strategies for setup/teardown logic, error handling, and test organization while supporting incremental refactoring of existing test files.
Master Swift Testing, the modern framework for Swift unit tests in Xcode 16+. Learn to write tests with @Test and @Suite, use #expect and #require for assertions, organize tests with traits, handle async patterns, and migrate from XCTest. This skill covers test attachments, exit testing, known issues, and version-gated APIs to help you build reliable test suites.
This skill equips AI coding assistants with specialized knowledge for troubleshooting flaky tests in Swift and Apple OS environments. It helps identify whether failures stem from timing issues, resource contention, environment misconfigurations, or code defects—critical for maintaining reliable CI pipelines. Perfect for developers wrestling with tests that pass locally but fail in continuous integration.
Axiom Audit Testing systematically scans your test files and production code to surface flaky patterns, missing coverage on critical paths, and opportunities to modernize your test suite. It identifies sleep calls and shared state that cause timing failures, flags tests that require unnecessary simulator overhead, and maps which auth, payment, persistence, and networking flows lack test coverage. The agent also spots XCTestCase candidates ready for Swift Testing migration and detects ungrounded AI evaluation gates that generate false failures.
This skill enables developers to systematically test Cometchat's messaging capabilities on iOS devices, ensuring chat features work reliably across Apple platforms. Verify user interactions, message delivery, and real-time communication performance with structured testing workflows.
This skill covers the core patterns that make Swift code safe and maintainable. You'll learn when to use structs over classes, how to handle optionals without crashes, design with protocols instead of inheritance, and leverage Swift's concurrency model. The guide includes practical examples of error handling, property wrappers, actors, and testing strategies—plus anti-patterns to avoid.
More skills ios-development (MIT) · xcuitest-skill (MIT) · swift-expert (Apache-2.0) · swift-actor-persistence (MIT)