axiom-testing

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Testing

测试

You MUST use this skill for ANY testing-related question, including writing tests, debugging test failures, making tests faster, or choosing between testing approaches.
任何与测试相关的问题都必须使用本技能,包括编写测试、调试测试失败、提升测试速度或选择测试方案。

Quick Reference

快速参考

Symptom / TaskReference
Writing unit tests, Swift Testing (@Test, #expect)See
skills/swift-testing.md
Making tests run without simulatorSee
skills/swift-testing.md
Parameterized tests, tags, traitsSee
skills/swift-testing.md
Migrating from XCTest to Swift TestingSee
skills/swift-testing.md
Testing async/await functionsSee
skills/testing-async.md
confirmation for callbacksSee
skills/testing-async.md
@MainActor tests, parallel executionSee
skills/testing-async.md
Writing UI tests, XCUITestSee
skills/ui-testing.md
Condition-based waiting patternsSee
skills/ui-testing.md
Recording UI Automation (Xcode 26)See
skills/ui-testing.md
Network conditioning, multi-factor testingSee
skills/ui-testing.md
XCUIElement queries, waiting strategiesSee
skills/xctest-automation.md
Accessibility identifiers, test plansSee
skills/xctest-automation.md
CI/CD test executionSee
skills/xctest-automation.md
Record/Replay/Review workflow (Xcode 26)See
skills/ui-recording.md
Test plan multi-configuration replaySee
skills/ui-recording.md
Enhancing recorded tests for stabilitySee
skills/ui-recording.md
症状/任务参考文档
编写单元测试、Swift Testing(@Test、#expect)查看
skills/swift-testing.md
无需模拟器运行测试查看
skills/swift-testing.md
参数化测试、标签、特性查看
skills/swift-testing.md
从XCTest迁移至Swift Testing查看
skills/swift-testing.md
测试async/await函数查看
skills/testing-async.md
回调确认查看
skills/testing-async.md
@MainActor测试、并行执行查看
skills/testing-async.md
编写UI测试、XCUITest查看
skills/ui-testing.md
基于条件的等待模式查看
skills/ui-testing.md
录制UI自动化(Xcode 26)查看
skills/ui-testing.md
网络调节、多因素测试查看
skills/ui-testing.md
XCUIElement查询、等待策略查看
skills/xctest-automation.md
无障碍标识符、测试计划查看
skills/xctest-automation.md
CI/CD测试执行查看
skills/xctest-automation.md
录制/重放/审阅工作流(Xcode 26)查看
skills/ui-recording.md
测试计划多配置重放查看
skills/ui-recording.md
增强录制测试的稳定性查看
skills/ui-recording.md

Decision Tree

决策树

dot
digraph testing {
    start [label="Testing task" shape=ellipse];
    what [label="What kind of test?" shape=diamond];

    start -> what;
    what -> "skills/swift-testing.md" [label="unit tests,\nSwift Testing,\nfast tests"];
    what -> "skills/testing-async.md" [label="testing async code,\ncallbacks,\nconfirmation"];
    what -> "skills/ui-testing.md" [label="UI tests,\nflaky tests,\nrecording"];
    what -> "skills/xctest-automation.md" [label="XCUITest patterns,\nelement queries"];
    what -> "skills/ui-recording.md" [label="Xcode 26\nRecord/Replay/Review"];
}
  1. Writing unit tests / Swift Testing? →
    skills/swift-testing.md
  2. Testing async/await code? →
    skills/testing-async.md
  3. Writing UI tests / XCUITest / flaky tests? →
    skills/ui-testing.md
  4. XCUIElement queries, waiting, test plans, CI? →
    skills/xctest-automation.md
  5. Record UI interactions (Xcode 26)? →
    skills/ui-recording.md
  6. Flaky tests / race conditions (Swift Testing)? → test-failure-analyzer (Agent)
  7. Tests crash / environment wrong? → See axiom-build (skills/xcode-debugging.md)
  8. Run tests from CLI / parse results? → test-runner (Agent)
  9. Fix failing tests automatically? → test-debugger (Agent)
  10. Want test quality audit? → testing-auditor (Agent) or
    /axiom:audit testing
  11. Automate without XCUITest / AXe CLI? → simulator-tester (Agent) + See axiom-xcode-mcp (skills/axe-ref.md)
dot
digraph testing {
    start [label="Testing task" shape=ellipse];
    what [label="What kind of test?" shape=diamond];

    start -> what;
    what -> "skills/swift-testing.md" [label="unit tests,\nSwift Testing,\nfast tests"];
    what -> "skills/testing-async.md" [label="testing async code,\ncallbacks,\nconfirmation"];
    what -> "skills/ui-testing.md" [label="UI tests,\nflaky tests,\nrecording"];
    what -> "skills/xctest-automation.md" [label="XCUITest patterns,\nelement queries"];
    what -> "skills/ui-recording.md" [label="Xcode 26\nRecord/Replay/Review"];
}
  1. 编写单元测试/使用Swift Testing?→
    skills/swift-testing.md
  2. 测试async/await代码?→
    skills/testing-async.md
  3. 编写UI测试/XCUITest/调试不稳定测试?→
    skills/ui-testing.md
  4. XCUIElement查询、等待、测试计划、CI相关?→
    skills/xctest-automation.md
  5. 录制UI交互(Xcode 26)?→
    skills/ui-recording.md
  6. 不稳定测试/竞态条件(Swift Testing)?→ test-failure-analyzer(Agent)
  7. 测试崩溃/环境异常?→ 查看axiom-build(skills/xcode-debugging.md)
  8. 从CLI运行测试/解析结果?→ test-runner(Agent)
  9. 自动修复失败测试?→ test-debugger(Agent)
  10. 想要测试质量审计?→ testing-auditor(Agent)或
    /axiom:audit testing
  11. 无需XCUITest/AXe CLI实现自动化?→ simulator-tester(Agent)+ 查看axiom-xcode-mcp(skills/axe-ref.md)

Swift Testing vs XCTest Quick Guide

Swift Testing vs XCTest快速指南

NeedUse
Unit tests (logic, models)Swift Testing
UI tests (tap, swipe, assert screens)XCUITest (XCTest)
Tests without simulatorSwift Testing + Package/Framework
Parameterized testsSwift Testing
Performance measurementsXCTest (XCTMetric)
Objective-C testsXCTest
需求选用方案
单元测试(逻辑、模型)Swift Testing
UI测试(点击、滑动、断言界面)XCUITest(XCTest)
无需模拟器运行测试Swift Testing + Package/Framework
参数化测试Swift Testing
性能测量XCTest(XCTMetric)
Objective-C测试XCTest

Critical Patterns

关键模式

Swift Testing (
skills/swift-testing.md
):
  • @Test/@Suite macros, #expect/#require assertions
  • Parameterized testing for eliminating repetitive tests
  • Fast tests architecture: Package extraction, Host Application: None
  • Reliable async testing with withMainSerialExecutor and TestClock
  • Migration guide from XCTest (comparison table)
  • XCTestCase + Swift 6.2 MainActor compatibility fix
Async Testing (
skills/testing-async.md
):
  • confirmation for single/multiple callbacks
  • expectedCount: 0 to verify something never happens
  • @MainActor test isolation
  • Timeout control with .timeLimit
  • Parallel execution gotchas and .serialized
UI Testing (
skills/ui-testing.md
):
  • Condition-based waiting (replaces sleep())
  • Recording UI Automation (Xcode 26)
  • Network conditioning for 3G/LTE testing
  • Multi-factor testing (device size + network speed)
  • Crash debugging from UI test failures
XCUITest Automation (
skills/xctest-automation.md
):
  • Element identification with accessibilityIdentifier
  • Waiting strategies (appear, disappear, hittable)
  • Test plans for multi-configuration testing
  • CI/CD integration with parallel execution
UI Recording (
skills/ui-recording.md
):
  • Xcode 26 Record/Replay/Review workflow
  • Enhancing recorded code for stability
  • Query selection guidelines
  • Test plan configuration for multi-language replay
Swift Testing
skills/swift-testing.md
):
  • @Test/@Suite宏、#expect/#require断言
  • 参数化测试,消除重复测试
  • 快速测试架构:提取Package、设置Host Application: None
  • 借助withMainSerialExecutor和TestClock实现可靠的异步测试
  • 从XCTest迁移指南(对比表格)
  • XCTestCase + Swift 6.2 MainActor兼容性修复
异步测试
skills/testing-async.md
):
  • 单/多回调确认
  • expectedCount: 0 用于验证某事件从未发生
  • @MainActor测试隔离
  • 借助.timeLimit控制超时
  • 并行执行的注意事项与.serialized配置
UI测试
skills/ui-testing.md
):
  • 基于条件的等待(替代sleep())
  • 录制UI自动化(Xcode 26)
  • 网络调节,用于3G/LTE测试
  • 多因素测试(设备尺寸 + 网络速度)
  • 从UI测试失败中调试崩溃问题
XCUITest自动化
skills/xctest-automation.md
):
  • 借助accessibilityIdentifier识别元素
  • 等待策略(出现、消失、可点击)
  • 用于多配置测试的测试计划
  • 并行执行的CI/CD集成
UI录制
skills/ui-recording.md
):
  • Xcode 26录制/重放/审阅工作流
  • 增强录制代码的稳定性
  • 查询选择指南
  • 多语言重放的测试计划配置

Automated Scanning

自动化扫描

Test quality audit → Launch
testing-auditor
agent or
/axiom:audit testing
(maps test coverage shape against production code, detects flaky patterns and speed issues, identifies untested critical paths, scores overall test health)
Flaky test analysis → Launch
test-failure-analyzer
agent (scans for patterns causing intermittent failures in Swift Testing: missing confirmation, shared mutable state, missing @MainActor)
测试质量审计 → 启动
testing-auditor
agent或执行
/axiom:audit testing
(对比测试覆盖范围与生产代码,检测不稳定模式与速度问题,识别未测试的关键路径,对整体测试健康状况评分)
不稳定测试分析 → 启动
test-failure-analyzer
agent(扫描Swift Testing中导致间歇性失败的模式:缺失确认、共享可变状态、未添加@MainActor)

Anti-Rationalization

误区纠正

ThoughtReality
"Simple test question, I don't need the skill"Proper patterns prevent test debt.
skills/swift-testing.md
has copy-paste solutions.
"I know XCTest well enough"Swift Testing is significantly better for unit tests. Migration guide included.
"Tests are slow but it's fine"Fast tests enable TDD.
skills/swift-testing.md
shows how to run without simulator.
"I'll fix the flaky test with a sleep()"sleep() makes tests slower AND flakier.
skills/ui-testing.md
has condition-based waiting.
"I'll add tests later"Tests written after implementation miss edge cases.
错误想法实际情况
"只是简单的测试问题,我不需要这个技能"规范的模式能避免测试技术债务。
skills/swift-testing.md
提供了可直接复制的解决方案。
"我对XCTest已经足够熟悉了"Swift Testing在单元测试方面表现明显更优,且包含迁移指南。
"测试速度慢但没关系"快速测试支持测试驱动开发(TDD)。
skills/swift-testing.md
展示了无需模拟器运行测试的方法。
"我用sleep()来修复不稳定测试"sleep()会让测试更慢且更不稳定。
skills/ui-testing.md
提供了基于条件的等待方案。
"我之后再补测试"实现后再写测试会遗漏边缘场景。

Example Invocations

调用示例

User: "How do I write a unit test in Swift?" → Read:
skills/swift-testing.md
User: "My UI tests are flaky in CI" → Check codebase: XCUIApplication/XCUIElement? →
skills/ui-testing.md
→ Check codebase: @Test/#expect? → test-failure-analyzer (Agent)
User: "How do I test async code without flakiness?" → Read:
skills/testing-async.md
User: "What's the Swift Testing equivalent of XCTestExpectation?" → Read:
skills/testing-async.md
User: "I want my tests to run faster" → Read:
skills/swift-testing.md
(Strategy 1: Package extraction)
User: "Should I use Swift Testing or XCTest?" → Read:
skills/swift-testing.md
(Migration section) + this decision tree
User: "How do I record UI automation in Xcode 26?" → Read:
skills/ui-recording.md
User: "Run my tests and show me what failed" → Invoke: test-runner (Agent)
User: "Audit my tests for quality issues" → Invoke: testing-auditor (Agent)
用户:"如何用Swift编写单元测试?" → 阅读:
skills/swift-testing.md
用户:"我的UI测试在CI中不稳定" → 检查代码库:是否使用XCUIApplication/XCUIElement?→
skills/ui-testing.md
→ 检查代码库:是否使用@Test/#expect?→ test-failure-analyzer(Agent)
用户:"如何稳定地测试异步代码?" → 阅读:
skills/testing-async.md
用户:"Swift Testing中与XCTestExpectation等效的是什么?" → 阅读:
skills/testing-async.md
用户:"我想让测试运行得更快" → 阅读:
skills/swift-testing.md
(策略1:提取Package)
用户:"我应该用Swift Testing还是XCTest?" → 阅读:
skills/swift-testing.md
(迁移章节)+ 本决策树
用户:"如何在Xcode 26中录制UI自动化?" → 阅读:
skills/ui-recording.md
用户:"运行我的测试并显示失败内容" → 调用:test-runner(Agent)
用户:"审计我的测试是否存在质量问题" → 调用:testing-auditor(Agent)