qa-testing-ios by vasilyu1983/ai-agents-public
npx skills add https://github.com/vasilyu1983/ai-agents-public --skill qa-testing-ios使用 xcodebuild + Xcode 模拟器 (simctl) 来构建、运行和稳定 iOS 测试。
主要文档 : XCTest, Swift Testing, simctl, Xcode testing
-workspace 或 -project-scheme (以及可选的 -testPlan)OS=latest),以及是否需要真机广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
xcresult、覆盖率、截图/视频、日志| 任务 | 命令 |
|---|---|
| 列出方案 | xcodebuild -list -workspace MyApp.xcworkspace |
| 列出模拟器 | xcrun simctl list devices |
| 列出设备 (USB) | xcrun xctrace list devices |
| 启动模拟器 | xcrun simctl boot "iPhone 15 Pro" |
| 等待启动完成 | xcrun simctl bootstatus booted -b |
| 构建应用 | xcodebuild build -scheme MyApp -sdk iphonesimulator |
| 安装应用 | xcrun simctl install booted app.app |
| 运行测试 | xcodebuild test -scheme MyApp -destination 'platform=iOS Simulator,name=iPhone 15 Pro,OS=latest' -resultBundlePath TestResults.xcresult |
| 运行测试 (真机) | xcodebuild test -scheme MyApp -destination 'platform=iOS,id=<UDID>' -resultBundlePath TestResults.xcresult |
| 重置模拟器 | xcrun simctl shutdown all && xcrun simctl erase all |
| 截图 | xcrun simctl io booted screenshot screenshot.png |
| 录制视频 | xcrun simctl io booted recordVideo recording.mov |
workspace/project, scheme, testPlan, 目标设备)。-resultBundlePath);仅在适当时进行并行化和重试。xcresult 包中分析失败;通过重复测试确认偶发性失败;指定负责人和复现步骤进行隔离。-only-testing:TargetTests/ClassName/testMethod 和 -skip-testing:TargetTests/FlakyClass。-testPlan <plan> (保持设备/配置/运行一致)。-parallel-testing-enabled YES (+ -maximum-parallel-testing-workers N)。-resultBundlePath TestResults.xcresult。xcodebuild build-for-testing ... 然后 xcodebuild test-without-building ...。open TestResults.xcresult 或 xcrun xcresulttool get --path TestResults.xcresult --format json。常见模式 (标志因 Xcode 版本而异):
-retry-tests-on-failure -test-iterations 2-test-iterations 50 -test-repetition-mode until-failure-only-testing:TargetTests/ClassName/testMethod -test-iterations 20| 层级 | 框架 | 范围 |
|---|---|---|
| 单元测试 | XCTest / Swift Testing | 业务逻辑 (快速) |
| 快照测试 | XCTest + 快照库 | 视图渲染 |
| 集成测试 | XCTest | 持久化、网络 |
| UI 测试 | XCUITest | 关键用户旅程 |
除非项目有特殊要求,否则使用以下默认设置:
waitForExistence, expectations) 而非休眠。xcrun simctl privacy booted grant ...。name: iOS CI
on: [push, pull_request]
jobs:
test:
runs-on: macos-15
steps:
- uses: actions/checkout@v4
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: "16.0"
- run: |
set -euo pipefail
xcodebuild test \
-scheme MyApp \
-sdk iphonesimulator \
-destination 'platform=iOS Simulator,name=iPhone 15 Pro,OS=latest' \
-resultBundlePath TestResults.xcresult
- uses: actions/upload-artifact@v4
if: always()
with:
name: test-results
path: TestResults.xcresult
xcresult 包| 资源 | 用途 |
|---|---|
| references/swift-testing.md | Swift Testing 框架 |
| references/simulator-commands.md | 完整的 simctl 参考 |
| references/xctest-patterns.md | XCTest/XCUITest 模式 |
| references/xcuitest-patterns.md | XCUITest UI 测试模式 |
| references/snapshot-testing-ios.md | 视觉快照测试 |
| references/ios-ci-optimization.md | CI 流水线优化 |
| 技能 | 用途 |
|---|---|
| software-mobile | iOS 开发 |
| qa-testing-strategy | 测试策略 |
| qa-testing-mobile | 跨平台移动端 |
每周安装量
85
代码仓库
GitHub 星标数
49
首次出现
Jan 23, 2026
安全审计
安装于
codex69
opencode69
cursor68
gemini-cli67
github-copilot64
amp59
Use xcodebuild + Xcode Simulator (simctl) to build, run, and stabilize iOS tests.
Primary docs : XCTest, Swift Testing, simctl, Xcode testing
-workspace or -project-scheme (and optional -testPlan)OS=latest), and whether real devices are requiredxcresult, coverage, screenshots/video, logs| Task | Command |
|---|---|
| List schemes | xcodebuild -list -workspace MyApp.xcworkspace |
| List simulators | xcrun simctl list devices |
| List devices (USB) | xcrun xctrace list devices |
| Boot simulator | xcrun simctl boot "iPhone 15 Pro" |
| Wait for boot | xcrun simctl bootstatus booted -b |
| Build app | xcodebuild build -scheme MyApp -sdk iphonesimulator |
workspace/project, scheme, testPlan, destinations).-resultBundlePath); parallelize and retry only when appropriate.xcresult bundle; confirm flakes with repetition; quarantine with an owner and reproduction steps.-only-testing:TargetTests/ClassName/testMethod and -skip-testing:TargetTests/FlakyClass.-testPlan <plan> (keeps device/config/runs consistent).-parallel-testing-enabled YES (+ -maximum-parallel-testing-workers N).-resultBundlePath TestResults.xcresult.xcodebuild build-for-testing ... then xcodebuild test-without-building ....open TestResults.xcresult or .Common patterns (flags vary by Xcode version):
-retry-tests-on-failure -test-iterations 2-test-iterations 50 -test-repetition-mode until-failure-only-testing:TargetTests/ClassName/testMethod -test-iterations 20| Layer | Framework | Scope |
|---|---|---|
| Unit | XCTest / Swift Testing | Business logic (fast) |
| Snapshot | XCTest + snapshot libs | View rendering |
| Integration | XCTest | Persistence, networking |
| UI | XCUITest | Critical user journeys |
Use these defaults unless the project requires otherwise:
waitForExistence, expectations) over sleeps.xcrun simctl privacy booted grant ....name: iOS CI
on: [push, pull_request]
jobs:
test:
runs-on: macos-15
steps:
- uses: actions/checkout@v4
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: "16.0"
- run: |
set -euo pipefail
xcodebuild test \
-scheme MyApp \
-sdk iphonesimulator \
-destination 'platform=iOS Simulator,name=iPhone 15 Pro,OS=latest' \
-resultBundlePath TestResults.xcresult
- uses: actions/upload-artifact@v4
if: always()
with:
name: test-results
path: TestResults.xcresult
xcresult bundles on failure| Resource | Purpose |
|---|---|
| references/swift-testing.md | Swift Testing framework |
| references/simulator-commands.md | Complete simctl reference |
| references/xctest-patterns.md | XCTest/XCUITest patterns |
| references/xcuitest-patterns.md | XCUITest UI testing patterns |
| references/snapshot-testing-ios.md | Visual snapshot testing |
| references/ios-ci-optimization.md | CI pipeline optimization |
| Template | Purpose |
|---|---|
| assets/template-ios-ui-test-stability-checklist.md | Stability checklist |
| Skill | Purpose |
|---|---|
| software-mobile | iOS development |
| qa-testing-strategy | Test strategy |
| qa-testing-mobile | Cross-platform mobile |
Weekly Installs
85
Repository
GitHub Stars
49
First Seen
Jan 23, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
codex69
opencode69
cursor68
gemini-cli67
github-copilot64
amp59
GitHub Actions 官方文档查询助手 - 精准解答 CI/CD 工作流问题
43,400 周安装
| Install app | xcrun simctl install booted app.app |
| Run tests | xcodebuild test -scheme MyApp -destination 'platform=iOS Simulator,name=iPhone 15 Pro,OS=latest' -resultBundlePath TestResults.xcresult |
| Run tests (device) | xcodebuild test -scheme MyApp -destination 'platform=iOS,id=<UDID>' -resultBundlePath TestResults.xcresult |
| Reset simulators | xcrun simctl shutdown all && xcrun simctl erase all |
| Take screenshot | xcrun simctl io booted screenshot screenshot.png |
| Record video | xcrun simctl io booted recordVideo recording.mov |
xcrun xcresulttool get --path TestResults.xcresult --format json