본문으로 건너뛰기
Skillpedia
테스트6.0k · #14452

swift-testing-pro

하는 일

이 스킬은 AI가 Swift Testing 프레임워크를 쓰는 Swift 테스트를 작성하고 점검하도록 돕습니다. 최신 관례를 따르는 테스트를 원하는 Swift 개발자를 위한 것입니다.

사용하는 경우

  • ✓Swift 프로젝트에 새 단위 또는 통합 테스트를 작성하고 있을 때.
  • ✓오래된 XCTest 테스트를 Swift Testing으로 옮기고 싶을 때.
  • ✓비동기 테스트, 확인(confirmation), 시간 제한에 도움이 필요할 때.

스킬 링크

https://github.com/jacklandrin/OnlySwitch/blob/main/doc/skills/swift-testing-pro/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/jacklandrin/OnlySwitch/blob/main/doc/skills/swift-testing-pro/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“제 로그인 뷰 모델에 대한 Swift Testing 테스트를 실패 사례까지 포함해서 작성해 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

에이전트는 테스트 구조, 단언, 의존성에 관한 Swift Testing 관례를 따르고, 기존 테스트에서 실제 문제만 보고합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Write and review Swift Testing code for correctness, modern API usage, and adherence to project conventions. Report only genuine problems - do not nitpick or invent issues.

Review process:

  1. Ensure tests follow core Swift Testing conventions using references/core-rules.md.
  2. Validate test structure, assertions, dependency injection, and other best practices using references/writing-better-tests.md.
  3. Check async tests, confirmations, time limits, actor isolation, and networking mocks using references/async-tests.md.
  4. Ensure new features like raw identifiers, test scopes, exit tests, and attachments are used correctly using references/new-features.md.
  5. If migrating from XCTest, follow the conversion guidance in references/migrating-from-xctest.md.

If doing partial work, load only the relevant reference files.

Core Instructions

  • Target Swift 6.2 or later, using modern Swift concurrency.
  • As a Swift Testing developer, the user wants all new unit and integration tests to be written using Swift Testing, and they may ask for help migrating existing XCTest code to Swift Testing.
  • Swift Testing does not support UI tests – XCTest must be used there.
  • Use a consistent project structure, with folder layout determined by app features.

Swift Testing evolves with each Swift release, so expect three to four releases each year, each introducing new features. This means existing training data you have will naturally be outdated or missing key features.

This skill specifically draws upon the very latest Swift and Swift Testing code, which means it will suggest things you are not aware of. Treat the user’s installed toolchain as authoritative, but there's a fairly high chance Apple's documentation about the APIs will be stale, so treat them carefully.

Output Format

If the user asks for a review, organize findings by file. For each issue:

  1. State the file and relevant line(s).
  2. Name the rule being violated.
  3. Show a brief before/after code fix.

Skip files with no issues. End with a prioritized summary of the most impactful changes to make first.

If the user asks you to write or improve tests, follow the same rules above but make the changes directly instead of returning a findings report.

Example output:

UserTests.swift

Line 5: Use struct, not class, for test suites.

// Before
class UserTests: XCTestCase {

// After
struct UserTests {

Line 12: Use #expect instead of XCTAssertEqual.

// Before
XCTAssertEqual(user.name, "Taylor")

// After
#expect(user.name == "Taylor")

Line 30: Use #require for preconditions, not #expect.

// Before
#expect(users.isEmpty == false)
let first = users.first!

// After
let first = try #require(users.first)

Summary

  1. Fundamentals (high): Test suite on line 5 should be a struct, not a class inheriting from XCTestCase.
  2. Migration (medium): XCTAssertEqual on line 12 should be migrated to #expect.
  3. Assertions (medium): Force-unwrap on line 30 should use #require to unwrap safely and stop the test early on failure.

End of example.

References

  • references/core-rules.md - core Swift Testing rules: structs over classes, init/deinit over setUp/tearDown, parallel execution, parameterized tests, withKnownIssue, and tags.
  • references/writing-better-tests.md - test hygiene, structuring tests, hidden dependencies, #expect vs #require, Issue.record(), #expect(throws:), and verification methods.
  • references/async-tests.md - serialized tests, confirmation(), time limits, actor isolation, testing pre-concurrency code, and mocking networking.
  • references/new-features.md - raw identifiers, range-based confirmations, test scoping traits, exit tests, attachments, ConditionTrait.evaluate(), and the updated #expect(throws:) return value.
  • references/migrating-from-xctest.md - XCTest-to-Swift Testing conversion steps, assertion mappings, and floating-point tolerance via Swift Numerics.
자주 묻는 질문

UI 테스트에도 XCTest를 대체하나요?

아니요. Swift Testing이 UI 테스트를 지원하지 않으므로 UI 테스트에는 여전히 XCTest가 필요합니다.

오래된 테스트를 변환할 수 있나요?

네. XCTest에서 옮기는 방법에 대한 안내가 들어 있습니다.

어떤 Swift 버전을 가정하나요?

Swift 6.2 이상과 최신 Swift 동시성을 전제로 합니다.

상세 정보

작성자의 원본 설명

Writes, reviews, and improves Swift Testing code using modern APIs and best practices. Use when reading, writing, or reviewing projects that use Swift Testing.

repo: jacklandrin/OnlySwitch

인기도

GitHub 스타
6.0k
순위
#14452
라이선스
MIT
업데이트
2026. 11. 1.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬