axiom-testing
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseTesting
测试
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 / Task | Reference |
|---|---|
| Writing unit tests, Swift Testing (@Test, #expect) | See |
| Making tests run without simulator | See |
| Parameterized tests, tags, traits | See |
| Migrating from XCTest to Swift Testing | See |
| Testing async/await functions | See |
| confirmation for callbacks | See |
| @MainActor tests, parallel execution | See |
| Writing UI tests, XCUITest | See |
| Condition-based waiting patterns | See |
| Recording UI Automation (Xcode 26) | See |
| Network conditioning, multi-factor testing | See |
| XCUIElement queries, waiting strategies | See |
| Accessibility identifiers, test plans | See |
| CI/CD test execution | See |
| Record/Replay/Review workflow (Xcode 26) | See |
| Test plan multi-configuration replay | See |
| Enhancing recorded tests for stability | See |
| 症状/任务 | 参考文档 |
|---|---|
| 编写单元测试、Swift Testing(@Test、#expect) | 查看 |
| 无需模拟器运行测试 | 查看 |
| 参数化测试、标签、特性 | 查看 |
| 从XCTest迁移至Swift Testing | 查看 |
| 测试async/await函数 | 查看 |
| 回调确认 | 查看 |
| @MainActor测试、并行执行 | 查看 |
| 编写UI测试、XCUITest | 查看 |
| 基于条件的等待模式 | 查看 |
| 录制UI自动化(Xcode 26) | 查看 |
| 网络调节、多因素测试 | 查看 |
| XCUIElement查询、等待策略 | 查看 |
| 无障碍标识符、测试计划 | 查看 |
| CI/CD测试执行 | 查看 |
| 录制/重放/审阅工作流(Xcode 26) | 查看 |
| 测试计划多配置重放 | 查看 |
| 增强录制测试的稳定性 | 查看 |
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"];
}- Writing unit tests / Swift Testing? →
skills/swift-testing.md - Testing async/await code? →
skills/testing-async.md - Writing UI tests / XCUITest / flaky tests? →
skills/ui-testing.md - XCUIElement queries, waiting, test plans, CI? →
skills/xctest-automation.md - Record UI interactions (Xcode 26)? →
skills/ui-recording.md - Flaky tests / race conditions (Swift Testing)? → test-failure-analyzer (Agent)
- Tests crash / environment wrong? → See axiom-build (skills/xcode-debugging.md)
- Run tests from CLI / parse results? → test-runner (Agent)
- Fix failing tests automatically? → test-debugger (Agent)
- Want test quality audit? → testing-auditor (Agent) or
/axiom:audit testing - 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"];
}- 编写单元测试/使用Swift Testing?→
skills/swift-testing.md - 测试async/await代码?→
skills/testing-async.md - 编写UI测试/XCUITest/调试不稳定测试?→
skills/ui-testing.md - XCUIElement查询、等待、测试计划、CI相关?→
skills/xctest-automation.md - 录制UI交互(Xcode 26)?→
skills/ui-recording.md - 不稳定测试/竞态条件(Swift Testing)?→ test-failure-analyzer(Agent)
- 测试崩溃/环境异常?→ 查看axiom-build(skills/xcode-debugging.md)
- 从CLI运行测试/解析结果?→ test-runner(Agent)
- 自动修复失败测试?→ test-debugger(Agent)
- 想要测试质量审计?→ testing-auditor(Agent)或
/axiom:audit testing - 无需XCUITest/AXe CLI实现自动化?→ simulator-tester(Agent)+ 查看axiom-xcode-mcp(skills/axe-ref.md)
Swift Testing vs XCTest Quick Guide
Swift Testing vs XCTest快速指南
| Need | Use |
|---|---|
| Unit tests (logic, models) | Swift Testing |
| UI tests (tap, swipe, assert screens) | XCUITest (XCTest) |
| Tests without simulator | Swift Testing + Package/Framework |
| Parameterized tests | Swift Testing |
| Performance measurements | XCTest (XCTMetric) |
| Objective-C tests | XCTest |
| 需求 | 选用方案 |
|---|---|
| 单元测试(逻辑、模型) | 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 agent or (maps test coverage shape against production code, detects flaky patterns and speed issues, identifies untested critical paths, scores overall test health)
testing-auditor/axiom:audit testingFlaky test analysis → Launch agent (scans for patterns causing intermittent failures in Swift Testing: missing confirmation, shared mutable state, missing @MainActor)
test-failure-analyzer测试质量审计 → 启动 agent或执行(对比测试覆盖范围与生产代码,检测不稳定模式与速度问题,识别未测试的关键路径,对整体测试健康状况评分)
testing-auditor/axiom:audit testing不稳定测试分析 → 启动 agent(扫描Swift Testing中导致间歇性失败的模式:缺失确认、共享可变状态、未添加@MainActor)
test-failure-analyzerAnti-Rationalization
误区纠正
| Thought | Reality |
|---|---|
| "Simple test question, I don't need the skill" | Proper patterns prevent test debt. |
| "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. |
| "I'll fix the flaky test with a sleep()" | sleep() makes tests slower AND flakier. |
| "I'll add tests later" | Tests written after implementation miss edge cases. |
| 错误想法 | 实际情况 |
|---|---|
| "只是简单的测试问题,我不需要这个技能" | 规范的模式能避免测试技术债务。 |
| "我对XCTest已经足够熟悉了" | Swift Testing在单元测试方面表现明显更优,且包含迁移指南。 |
| "测试速度慢但没关系" | 快速测试支持测试驱动开发(TDD)。 |
| "我用sleep()来修复不稳定测试" | sleep()会让测试更慢且更不稳定。 |
| "我之后再补测试" | 实现后再写测试会遗漏边缘场景。 |
Example Invocations
调用示例
User: "How do I write a unit test in Swift?"
→ Read:
skills/swift-testing.mdUser: "My UI tests are flaky in CI"
→ Check codebase: XCUIApplication/XCUIElement? →
→ Check codebase: @Test/#expect? → test-failure-analyzer (Agent)
skills/ui-testing.mdUser: "How do I test async code without flakiness?"
→ Read:
skills/testing-async.mdUser: "What's the Swift Testing equivalent of XCTestExpectation?"
→ Read:
skills/testing-async.mdUser: "I want my tests to run faster"
→ Read: (Strategy 1: Package extraction)
skills/swift-testing.mdUser: "Should I use Swift Testing or XCTest?"
→ Read: (Migration section) + this decision tree
skills/swift-testing.mdUser: "How do I record UI automation in Xcode 26?"
→ Read:
skills/ui-recording.mdUser: "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?→
→ 检查代码库:是否使用@Test/#expect?→ test-failure-analyzer(Agent)
skills/ui-testing.md用户:"如何稳定地测试异步代码?"
→ 阅读:
skills/testing-async.md用户:"Swift Testing中与XCTestExpectation等效的是什么?"
→ 阅读:
skills/testing-async.md用户:"我想让测试运行得更快"
→ 阅读:(策略1:提取Package)
skills/swift-testing.md用户:"我应该用Swift Testing还是XCTest?"
→ 阅读:(迁移章节)+ 本决策树
skills/swift-testing.md用户:"如何在Xcode 26中录制UI自动化?"
→ 阅读:
skills/ui-recording.md用户:"运行我的测试并显示失败内容"
→ 调用:test-runner(Agent)
用户:"审计我的测试是否存在质量问题"
→ 调用:testing-auditor(Agent)