Maestro
$ maestro 官方出品 中风险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 流水线。
brew install mobile-dev-inc/tap/maestro maestro 直接通过 ADB/XCTest 驱动本地 iOS 与 Android 模拟器并在本地生成 JUnit XML 与截图产物,Agent 可直接读取结果。
Agent 友好度体检单
当前为静态评估(本机尚未安装或尚未运行探针)。可在本地运行 npm run data:probe 并提交 data/probes/ 升级为实测证据。
FCRS-1.0 六维评分拆解
支持 --format junit、--output、--test-output-dir 与 maestro hierarchy 等非交互能力,但缺少原生 --json 报告模式。
- Supports
--format junitand--outputfor structured CI reporting maestro hierarchyexposes UI element trees for test authoring
本地模拟器测试隔离良好;远端上传需显式调用 maestro cloud 并提供 MAESTRO_CLOUD_API_KEY。
- Clear separation between local
maestro testand remotemaestro cloud - Scoped
MAESTRO_CLOUD_API_KEYauthentication
可通过 Homebrew tap(mobile-dev-inc/tap/maestro)或官方脚本在 macOS、Linux、Windows 安装(依赖 Java 运行时)。
- Cross-platform install via Homebrew or
get.maestro.mobile.dev, requires JVM
简洁 YAML 语法配合内置抗抖动等待,替代繁琐的 Appium/XCUITest/Espresso 样板代码。
- Single YAML test runner for both iOS (
-p ios) and Android (-p android)
Mobile.dev 官方仓库(mobile-dev-inc/Maestro),Apache-2.0 开源协议。
- First-party
mobile-dev-inc/Maestrorepository
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 云端托管运行需付费方案或试用额度。
# 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 高频安全命令配方
只读查询(安全推荐)
maestro hierarchy
检查模拟器当前页面的无障碍视图树,便于 Agent 编写精准的 YAML 选择器。
maestro test --format junit --output maestro-report.xml .maestro/smoke.yaml
在本地执行声明式 YAML E2E 用例并输出机器可解析的 JUnit XML 报告。
受控写入与预演
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)。