CLI 目录 横向对比 FCRS-1.0 标准 /llms.txt
← 返回 CLI 目录

Maestro

$ maestro 官方出品 中风险
Mobile.dev · 办公协作与 SaaS · Apache-2.0 · macos / linux / windows

Maestro(mobile-dev-inc/Maestro)可在 iOS 模拟器、Android 模拟器及 Maestro Cloud 上执行声明式 YAML 端到端 UI 测试(maestro test、maestro cloud、maestro hierarchy)。支持 -p ios|android、--device、--format junit 与 --output,适配自动化 CI 流水线。

FCRS-1.0 综合评分
82 /100
良好 (Good)
中置信度 (源码/文档)
零摩擦安装命令
brew install mobile-dev-inc/tap/maestro
CLI vs MCP 选型建议 优先选 CLI

maestro 直接通过 ADB/XCTest 驱动本地 iOS 与 Android 模拟器并在本地生成 JUnit XML 与截图产物,Agent 可直接读取结果。

Agent 友好度体检单

— 原生 JSON 输出
— 字段裁剪
✓ 无头非交互
— 支持 Dry-Run
— 只读模式开关
— 支持 NO_COLOR
✓ 自省/Schema 发现
— 官方 SKILL.md

当前为静态评估(本机尚未安装或尚未运行探针)。可在本地运行 npm run data:probe 并提交 data/probes/ 升级为实测证据。

FCRS-1.0 六维评分拆解

Agent 友好度 19 / 25

支持 --format junit、--output、--test-output-dir 与 maestro hierarchy 等非交互能力,但缺少原生 --json 报告模式。

  • Supports --format junit and --output for structured CI reporting
  • maestro hierarchy exposes UI element trees for test authoring
安全与权限边界 20 / 25

本地模拟器测试隔离良好;远端上传需显式调用 maestro cloud 并提供 MAESTRO_CLOUD_API_KEY。

  • Clear separation between local maestro test and remote maestro cloud
  • Scoped MAESTRO_CLOUD_API_KEY authentication
安装与运行摩擦 13 / 15

可通过 Homebrew tap(mobile-dev-inc/tap/maestro)或官方脚本在 macOS、Linux、Windows 安装(依赖 Java 运行时)。

  • Cross-platform install via Homebrew or get.maestro.mobile.dev, requires JVM
能力覆盖与边际价值 13 / 15

简洁 YAML 语法配合内置抗抖动等待,替代繁琐的 Appium/XCUITest/Espresso 样板代码。

  • Single YAML test runner for both iOS (-p ios) and Android (-p android)
维护与来源背书 9 / 10

Mobile.dev 官方仓库(mobile-dev-inc/Maestro),Apache-2.0 开源协议。

  • First-party mobile-dev-inc/Maestro repository
文档与可验证性 8 / 10

docs.maestro.dev 文档结构清晰,涵盖 YAML 用例与 CLI 参数示例。

  • Official docs at docs.maestro.dev

安全边界、鉴权与放权指南

鉴权方式
无需鉴权 环境变量密钥
凭证存储位置

本地模拟器测试无需凭据;maestro cloud 通过 MAESTRO_CLOUD_API_KEY 或 --api-key 认证。

潜在副作用
只读查询 本地写入 远端写入
费用与配额提示

本地 CLI 采用 Apache-2.0 协议免费开源;Maestro Cloud 云端托管运行需付费方案或试用额度。

可复制到 CLAUDE.md / AGENTS.md 的安全护栏
# Maestro (maestro) Agent Rules
- Inspect UI elements with `maestro hierarchy` before editing `.maestro/*.yaml` flows.
- Always pass `--format junit --output <file>` on `maestro test` for deterministic pass/fail parsing.
- Confirm before running `maestro cloud` since it uploads app binaries externally.

Agent 高频安全命令配方

只读查询(安全推荐)

导出当前移动端 UI 视图层级
maestro hierarchy

检查模拟器当前页面的无障碍视图树,便于 Agent 编写精准的 YAML 选择器。

本地运行 Maestro 测试并输出 JUnit 报告
maestro test --format junit --output maestro-report.xml .maestro/smoke.yaml

在本地执行声明式 YAML E2E 用例并输出机器可解析的 JUnit XML 报告。

受控写入与预演

上传应用包与测试流至 Maestro Cloud
maestro cloud --api-key "$MAESTRO_CLOUD_API_KEY" ./build/app.apk .maestro/

将移动端安装包与 YAML 测试集提交至 Maestro Cloud 进行云端执行。

核心优势

  • + 声明式 YAML 与 maestro hierarchy 视图导出让编码 Agent 更容易编写和定位移动端 E2E 测试。
  • + --format junit 可生成确定性的 XML 测试报告供 CI 解析。

注意事项与踩坑点

  • ! 运行依赖 Java 环境(JDK)以及已启动的 iOS 模拟器或 Android 模拟器/真机。
  • ! 暂不支持原生 --json 报告格式(仅支持 junit、html 与 noop)。

已验证兼容的 Agent 宿主

Claude Code Codex CLI Gemini CLI