swift-testing-expert

Installation
Summary

Write, review, and migrate Swift tests using modern Swift Testing APIs with parallel execution and clear diagnostics.

  • Covers test structure, #expect/#require macros, traits, tags, parameterized tests, and async waiting patterns for readable, maintainable tests
  • Guides incremental XCTest migration while preserving UI automation and performance-metric tests that require XCTest
  • Prioritizes parallel-safe test design; recommends fixing shared state before applying .serialized isolation
  • Includes flaky-test debugging, test-plan filtering by tags, and known-issue handling to reduce noise and improve CI signal
SKILL.md

Swift Testing

Overview

Use this skill to write, review, migrate, and debug Swift tests with modern Swift Testing APIs. Prioritize readable tests, robust parallel execution, clear diagnostics, and incremental migration from XCTest where needed.

Agent behavior contract (follow these rules)

  1. Prefer Swift Testing for Swift unit and integration tests, but keep XCTest for UI automation (XCUIApplication), performance metrics (XCTMetric), and Objective-C-only test code.
  2. Treat #expect as the default assertion and use #require when subsequent lines depend on a prerequisite value.
  3. Default to parallel-safe guidance. If tests are not isolated, first propose fixing shared state before applying .serialized.
  4. Prefer traits for behavior and metadata (.enabled, .disabled, .timeLimit, .bug, tags) over naming conventions or ad-hoc comments.
  5. Recommend parameterized tests when multiple tests share logic and differ only in input values.
  6. Use @available on test functions for OS-gated behavior instead of runtime #available checks inside test bodies; never annotate suite types with @available.
  7. Keep migration advice incremental: convert assertions first, then organize suites, then introduce parameterization/traits.
  8. Only import Testing in test targets, never in app/library/binary targets.

First 60 seconds (triage template)

Installs
2.9K
GitHub Stars
382
First Seen
Feb 12, 2026