360 Secure SkillHub
360 安全技能中心

Native Automation

基于苹果官方XCTest等工具,为iOS/macOS应用提供单元逻辑、UI交互、快照视觉回归、性能、无障碍等多类测试,还支持关键路径验证。可通过指定模式的脚本快速执行测试,也支持按规范编写自定义用例,适应用质量全流程验证需求。

soponcd
soponcd
热度 42.51
最近更新 2026-05-11 17:36:23
分类:开发依赖:代码执行 / 读写文件应用场景:代码生成 / 调试排错 / DevOps / 自动化脚本

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add native-automation
Metadata
name
native_automation
description
Apple Native Automation & Testing Skill
version
1.0.0
domain
ios-macos
homepage
https://github.com/soponcd/timeflow-skills/tree/main/teams/skills/native_automation
metadata
{"clawdbot":{"emoji":"🤖"}}

Native Automation Skill

Philosophy: Use Apple's first-party tools (XCTest, XCUITest, Instruments) as the source of truth for quality.

Capabilities

  1. Unit Testing Logic: fast, isolated logic verification.
  2. UI Testing: End-to-end user flow verification.
  3. Snapshot Testing: Visual regression testing.
  4. Performance Testing: XCTMetric verification.
  5. Accessibility Testing: Automated audit via XCUITest.
  6. Hero Flow Verification: Integrated critical path testing (Input -> Process -> Connect).

Usage

1. Execute Tests via Script

Always use the wrapper script to ensure correct scheme and destination settings.

./tools/run_native_tests.sh [mode]

Modes:

  • unit: Run unit tests only (Logic layer).
  • ui: Run UI tests only (Interaction layer).
  • fast: Run unit + critical UI paths.
  • full: Run ALL tests (including performance and snapshots).

2. Writing Tests

  • Unit: Inherit from XCTestCase. Use XCTAssert....
  • UI: Inherit from XCTestCase. Use XCUIApplication.
  • Performance: Use measure(metrics:options:block:).

Best Practices

  • Isolation: Reset state before each UI test (app.launchArguments += ["-reset"]).
  • Accessibility: Use app.buttons["identifier"] over static texts.
  • Concurrency: Use XCTestExpectation for async code.