SuperAPI AI 工具集

axiom-analyze-test-failures

测试与质量

查看项目

更新于 10-15 20:11

技能介绍

用途:诊断 Swift 测试失败的根本原因,重点处理 flaky、本地通过但 CI 失败、测试竞态,以及需要判断某个测试为何失败的情况。主要能力:扫描 *Tests.swift、*Test.swift、**/Tests/.swift(跳过 Pods、Carthage、.build、DerivedData、scratch、docs、.claude、.claude-plugin),按七类模式定位问题——缺少 await confirmation、UI 测试缺 @MainActor、@Suite 中 static var 等共享可变状态、Task.sleep 计时等待、缺 .serialized、测试崩溃(.ips 日志)、#expect 中使用 Date() 比较。使用方式:用 Glob 找测试文件,用 Grep 搜 .sink{|completion:|.fetch{、@Test、static var、Task.sleep、@Suite、#expect.Date() 等,再读上下文确认非误报;有崩溃日志时先查看 ls -lt ~/Library/Logs/DiagnosticReports/.ips 2>/dev/null | head -5,再运行 xcsym crash --format=summary <path-to-ips>,按 pattern_tag 路由修复。适用场景:Swift Testing(iOS 18+)项目的 CI 稳定性排查。限制:仅针对 Swift 测试与上述模式,不覆盖其他语言;结论需人工核对上下文,避免把 static let、已有 confirmation/@MainActor/.serialized 误报;修复验证可用 swift test --parallel --num-workers 8、swift test --filter "TestName" --maximum-repetitions 100 或 Xcode 的 Repeat Until Failure。具体平台支持与价格暂未提供。