@pzy560117/opentest 0.1.9 → 0.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/assets/manifest.json +12 -1
  2. package/assets/skills/opentest/references/api-testing.md +77 -0
  3. package/assets/skills/opentest/references/codex-harness-coverage-heuristics.md +17 -1
  4. package/assets/skills/opentest/references/complete-testing-workflow.md +27 -0
  5. package/assets/skills/opentest/references/desktop-gui-testing.md +52 -0
  6. package/assets/skills/opentest/references/matrix-format.md +12 -2
  7. package/assets/skills/opentest/references/opentest-driven-development.md +10 -0
  8. package/assets/skills/opentest/references/test-asset-layout.md +64 -0
  9. package/assets/skills/opentest/references/test-surfaces.md +101 -0
  10. package/assets/skills/opentest/references/web-browser-testing.md +40 -0
  11. package/assets/skills/opentest/templates/acceptance-template.md +3 -1
  12. package/assets/skills/opentest/templates/api-acceptance-template.md +44 -0
  13. package/assets/skills/opentest/templates/desktop-gui-acceptance-template.md +43 -0
  14. package/assets/skills/opentest/templates/matrix-template.md +12 -11
  15. package/assets/skills/opentest/templates/plan-template.md +2 -2
  16. package/assets/skills/opentest/templates/web-acceptance-template.md +27 -0
  17. package/assets/skills/opentest-accept/SKILL.md +15 -6
  18. package/assets/skills/opentest-api/SKILL.md +25 -0
  19. package/assets/skills/opentest-author/SKILL.md +7 -5
  20. package/assets/skills/opentest-desktop-gui/SKILL.md +24 -0
  21. package/assets/skills/opentest-plan/SKILL.md +15 -9
  22. package/assets/skills/opentest-run/SKILL.md +14 -8
  23. package/assets/skills/opentest-web-browser/SKILL.md +26 -0
  24. package/assets/skills-zh/opentest/references/api-testing.md +77 -0
  25. package/assets/skills-zh/opentest/references/codex-harness-coverage-heuristics.md +17 -1
  26. package/assets/skills-zh/opentest/references/complete-testing-workflow.md +27 -0
  27. package/assets/skills-zh/opentest/references/desktop-gui-testing.md +52 -0
  28. package/assets/skills-zh/opentest/references/matrix-format.md +12 -2
  29. package/assets/skills-zh/opentest/references/opentest-driven-development.md +10 -0
  30. package/assets/skills-zh/opentest/references/test-asset-layout.md +64 -0
  31. package/assets/skills-zh/opentest/references/test-surfaces.md +101 -0
  32. package/assets/skills-zh/opentest/references/web-browser-testing.md +40 -0
  33. package/assets/skills-zh/opentest/templates/acceptance-template.md +3 -1
  34. package/assets/skills-zh/opentest/templates/api-acceptance-template.md +44 -0
  35. package/assets/skills-zh/opentest/templates/desktop-gui-acceptance-template.md +43 -0
  36. package/assets/skills-zh/opentest/templates/matrix-template.md +12 -11
  37. package/assets/skills-zh/opentest/templates/plan-template.md +2 -2
  38. package/assets/skills-zh/opentest/templates/web-acceptance-template.md +27 -0
  39. package/assets/skills-zh/opentest-accept/SKILL.md +14 -5
  40. package/assets/skills-zh/opentest-api/SKILL.md +25 -0
  41. package/assets/skills-zh/opentest-author/SKILL.md +7 -5
  42. package/assets/skills-zh/opentest-desktop-gui/SKILL.md +24 -0
  43. package/assets/skills-zh/opentest-plan/SKILL.md +13 -7
  44. package/assets/skills-zh/opentest-run/SKILL.md +13 -7
  45. package/assets/skills-zh/opentest-web-browser/SKILL.md +26 -0
  46. package/package.json +1 -1
  47. package/scripts/smoke-test.js +309 -1
@@ -0,0 +1,64 @@
1
+ # 测试资产目录契约
2
+
3
+ OpenTest 默认测试资产采用方案 B:标准测试框架骨架。不得在 `author` 阶段临场决定目录。
4
+
5
+ ## 默认目录
6
+
7
+ ```text
8
+ tests/
9
+ api/
10
+ conftest.py
11
+ clients/
12
+ fixtures/
13
+ schemas/
14
+ test_contract_*.py
15
+ test_permissions_*.py
16
+ test_crud_*.py
17
+ web/
18
+ playwright/
19
+ midscene/
20
+ android/
21
+ tests_py/
22
+ midscene/
23
+ desktop/
24
+ scripts/
25
+ midscene/
26
+ metadata/
27
+
28
+ docs/opentest/
29
+ matrix.md
30
+ fixtures/
31
+ acceptance/
32
+ runs/
33
+ reports/
34
+
35
+ scripts/
36
+ opentest-run-api.ps1
37
+ opentest-run-web.ps1
38
+ opentest-run-android.ps1
39
+ opentest-run-desktop.ps1
40
+ ```
41
+
42
+ 如果项目已经有接近的目录,优先贴合现有目录,但逻辑槽位必须保持一致:执行面测试放在 `tests/<surface>/`,证据放在 `docs/opentest/`,可重复入口放在 `scripts/opentest-run-*.ps1` 或仓库等价命令。
43
+
44
+ ## 形态规则
45
+
46
+ - 默认不是大型 QA 平台,而是稳定的测试、fixtures、报告和运行入口骨架。
47
+ - 不要把一次性脚本作为 durable path。一次性脚本只能用于 `instant-acceptance` 或 blocked 排查证据。
48
+ - 除非用户明确选择团队级模板,不要创建独立顶层 QA 项目。
49
+ - `author` 只能在已选目录契约内创建或更新资产。
50
+ - `run` 调用固定入口命令,不临时发明路径。
51
+ - `accept` 把验收证据写到 `docs/opentest/acceptance/`,把运行产物写到 `docs/opentest/runs/` 或 `docs/opentest/reports/`。
52
+
53
+ ## 执行面映射
54
+
55
+ | 执行面 | 稳定测试位置 | 默认运行入口 |
56
+ | --- | --- | --- |
57
+ | `api` | `tests/api/` | `scripts/opentest-run-api.ps1` 或 `python -m pytest tests/api -v` |
58
+ | `web-browser` | `tests/web/playwright/` 和 `tests/web/midscene/` | `scripts/opentest-run-web.ps1` 或项目 E2E 命令 |
59
+ | `android-app` | `tests/android/tests_py/` 和 `tests/android/midscene/` | `scripts/opentest-run-android.ps1` 或现有 Android harness 中的 `python -m pytest tests_py -v` |
60
+ | `desktop-gui` | `tests/desktop/scripts/`、`tests/desktop/midscene/`、`tests/desktop/metadata/` | `scripts/opentest-run-desktop.ps1` 或项目 GUI 命令 |
61
+
62
+ ## 什么时候使用轻量形态
63
+
64
+ 只有矩阵行明确是一次性、探索性或 blocked 排查时,才使用轻量脚本形态。必须标明它不是 durable regression,并在 `gap/blocker` 记录原因。
@@ -0,0 +1,101 @@
1
+ # 测试执行面
2
+
3
+ OpenTest 同时按执行面和证据层级分类验收:
4
+
5
+ - `执行面` 是从用户或调用方视角实际操作需求的位置。
6
+ - `证据层级` 是证明需求的方式,例如 unit、integration、contract、e2e、smoke 或 security review。
7
+ - 测试资产使用 `opentest/references/test-asset-layout.md` 的固定目录;不得在 author 时临场发明目录。
8
+
9
+ 主执行面只能使用下面四个值:
10
+
11
+ | 执行面 | 适用场景 | 默认验收路径 | 必需产物 |
12
+ | --- | --- | --- | --- |
13
+ | `web-browser` | 浏览器渲染的 Web 页面、Web App、后台、SaaS、仪表盘 | 使用 `opentest-web-browser`:优先 Playwright MCP,失败时降级 Playwright CLI;稳定回归用 `@playwright/test`;视觉补充才用 Midscene | 截图、snapshot、提交后断言、console/network 记录、稳定回归的 trace/report |
14
+ | `android-app` | Android APK 或模拟器/真机上的 Android App GUI | 有 `android-midscene-pytest` skill 时使用它:pytest 编排,`@midscene/android` 执行视觉自动化,ADB/模拟器控制设备 | pytest 报告、Midscene HTML 报告、截图、logcat、设备/App 元数据 |
15
+ | `desktop-gui` | 原生桌面 GUI 或 Electron/Tauri/Windows/macOS/Linux App UI | 使用 `opentest-desktop-gui`:优先项目 GUI 自动化;视觉桌面自动化、弱选择器、原生控件、多窗口流程或 RDP 用 `@midscene/computer`;没有自动化时才用脚本化人工 GUI 验收 | 截图或录屏、GUI 操作日志、窗口/App 元数据、确定性回读、失败截图 |
16
+ | `api` | HTTP API、RPC、后端工作流、契约、服务端点 | 使用 `opentest-api`:优先项目 API/integration 命令;否则用 `pytest` + `httpx` 或 `requests`、schema 校验、fixtures 和写后读证据 | 请求/响应记录、状态码、payload/schema 断言、鉴权/权限结果、数据一致性、cleanup/teardown、日志 |
17
+
18
+ 不要发明第五种主执行面。`unit`、`component`、`integration`、`contract`、`smoke`、`security-review` 这类是证据层级或运行门禁,不是主执行面。
19
+
20
+ ## 执行面 vs 证据层级
21
+
22
+ 示例:
23
+
24
+ | 需求 | 执行面 | 证据层级 |
25
+ | --- | --- | --- |
26
+ | 用户提交 Web 表单并看到保存后的条目 | `web-browser` | `browser-acceptance` + `integration` |
27
+ | Android 用户在 App 里创建任务 | `android-app` | `e2e` + `visual-acceptance` |
28
+ | 桌面应用打开设置弹窗并保存偏好 | `desktop-gui` | `gui-acceptance` + `integration` |
29
+ | 调用方通过 REST API 创建实体 | `api` | `contract` + `integration` |
30
+
31
+ ## Android App 执行面
32
+
33
+ Android GUI 工作如果已安装 `android-midscene-pytest`,默认路由到它:
34
+
35
+ ```text
36
+ python -m pytest tests_py -v
37
+ -> npm/Vitest wrapper
38
+ -> @midscene/android
39
+ -> ADB + Android emulator/device
40
+ -> screenshots + logcat + Midscene HTML report
41
+ ```
42
+
43
+ 路线选择:
44
+
45
+ - 稳定自动化、演示和可回归报告:默认 `pytest -> npm/Vitest -> @midscene/android -> ADB`。
46
+ - 一次性自然语言探索:可选 Midscene YAML runner,但不能替代 pytest 主入口。
47
+ - Agent 直接控制 Android:只有单独配置 `MIDSCENE_MCP_ANDROID_MODE=true` 时才可选 Midscene MCP;不得自动写入全局 MCP 配置。
48
+ - 纯 Python 测试栈:只有用户明确要求时才评估 `midscene-python`。
49
+
50
+ 分层运行:
51
+
52
+ - 面向用户的入口是 `python -m pytest tests_py -v`。
53
+ - pytest 应先检查 ADB、准备模拟器/真机、安装 APK、运行 ADB 冒烟并采集证据,再进入 Midscene。
54
+ - 只有模型环境变量齐全时才运行 `npm run test:android`。
55
+ - 只有排查 Midscene 层问题时,才单独运行 `npm run test:android`。
56
+
57
+ 如果缺 Midscene 模型凭据、ADB、模拟器/真机、APK 路径或 package name,记录 `blocked` 并写清缺失前置条件。不能只凭静态截图把 Android GUI 验收标成 pass。
58
+
59
+ 失败证据应尽量包含 `midscene_run/log/ai-call.log`、`midscene_run/log/agent.log`、`midscene_run/log/android-device.log` 和 `midscene_run/report/*.html`。
60
+
61
+ ## Web 浏览器执行面
62
+
63
+ `web-browser` 行读取 `opentest/references/web-browser-testing.md`,或调用 `opentest-web-browser`。
64
+
65
+ 必须设置 `验收模式`:
66
+
67
+ - `instant-acceptance`:优先 Playwright MCP,失败或不稳定时降级 Playwright CLI。
68
+ - `durable-regression`:`@playwright/test` 或项目已有 E2E 框架。
69
+ - `visual-ai-assist`:Midscene 只用于弱选择器、canvas、跨 frame 或视觉匹配。
70
+
71
+ 不得把 MCP 或 Playwright CLI 证据本身当成稳定回归。
72
+
73
+ ## 桌面 GUI 执行面
74
+
75
+ `desktop-gui` 行读取 `opentest/references/desktop-gui-testing.md`,或调用 `opentest-desktop-gui`。
76
+
77
+ 路线选择:
78
+
79
+ - 仓库已有可重复命令时,优先项目 GUI 自动化。
80
+ - 原生控件、视觉流程、弱选择器、多窗口流程,或需要 AI 视觉辅助的 Windows RDP,用 `@midscene/computer`。
81
+ - Electron 或 Tauri 如果需求可通过 DOM 验证,使用 `web-browser`;原生外壳、托盘、文件选择器、菜单、系统弹窗、安装器、更新器和多窗口行为保留在 `desktop-gui`。
82
+ - 脚本化人工 GUI 验收只作为一次性证据兜底,不是稳定回归。
83
+
84
+ 不得只凭 AI 视觉断言把 `desktop-gui` 标为 PASS。保存/新增/修改/删除流程必须包含截图或录屏、GUI 操作日志、窗口/App 元数据,以及重开、重启或读取可信 App/文件/配置状态后的确定性 read/assert changed result。
85
+
86
+ ## API 执行面
87
+
88
+ `api` 行读取 `opentest/references/api-testing.md`,或调用 `opentest-api`。
89
+
90
+ 路线选择:
91
+
92
+ - 优先使用明确的项目 API、integration、contract 或 smoke 命令。
93
+ - 没有项目命令时,默认 `python -m pytest tests/api -v`,用 `httpx` 或 `requests` 发请求,用 `jsonschema` 或项目已有 Pydantic/DTO 模型做 schema 校验,并用 pytest fixtures 管 seed/teardown。
94
+ - 用 OpenAPI、protobuf、schema 文件、DTO、serializer、typed client 或需求文档作为契约来源。
95
+ - 第三方 API 默认 mock/stub;只有需求明确要求 live 外部服务时才直接调用。
96
+
97
+ 不得只凭 2xx 响应把 `api` 标为 PASS。API 写操作必须包含请求/响应记录、payload/schema 断言、适用时的鉴权/权限检查、写后读/数据一致性,以及 cleanup 或 teardown 证明。
98
+
99
+ ## 矩阵规则
100
+
101
+ 每条矩阵行必须同时包含 `执行面` 和 `证据层级`。`web-browser` 行还必须包含 `验收模式`。如果一个需求需要多个执行面或模式,拆成多行,或明确主执行面,并在 `必需证据` 中写次要证据。
@@ -0,0 +1,40 @@
1
+ # Web 浏览器测试
2
+
3
+ 用于 `web-browser` 执行面的矩阵行。
4
+
5
+ 稳定 Web 资产遵循 `opentest/references/test-asset-layout.md`:Playwright 测试放 `tests/web/playwright/`,Midscene 视觉辅助放 `tests/web/midscene/`,可重复入口使用 `scripts/opentest-run-web.ps1` 或仓库已有 E2E 命令。
6
+
7
+ ## 验收模式
8
+
9
+ | 模式 | 适用场景 | 默认工具 | 必需证据 |
10
+ | --- | --- | --- | --- |
11
+ | `instant-acceptance` | 现在就要证明本次变更在真实浏览器中生效 | 优先 Playwright MCP,失败或不稳定时降级 Playwright CLI | snapshot、操作步骤、提交后断言、截图、console/network 记录 |
12
+ | `durable-regression` | 这个流程以后要在 CI 或版本回归里重复运行 | `@playwright/test` 或项目已有 E2E 框架 | 已提交测试文件、稳定 locator/断言、命令、report/trace 路径 |
13
+ | `visual-ai-assist` | selector 难以可靠证明 UI 状态 | Midscene + Playwright 或项目浏览器驱动 | Midscene 报告、截图、确定性的回读/断言结果 |
14
+
15
+ ## 工具规则
16
+
17
+ - Playwright MCP 和 Playwright CLI 是现场验收工具,适合即时探索和证明;它们本身不等于稳定回归。
18
+ - `@playwright/test` 或项目已有 E2E 框架才是 Web 稳定回归的默认路径。
19
+ - Midscene 是 AI 视觉 UI 自动化补充层,适合弱选择器、canvas、跨 frame、视觉匹配或自然语言探索。
20
+ - `visual-ai-assist` 不能只凭 AI 断言标 PASS。写操作后必须重新读取可信结果面。
21
+
22
+ ## Web 写操作必需链路
23
+
24
+ ```text
25
+ open -> snapshot -> fill/input -> click(submit/confirm) -> snapshot -> read/assert changed result -> screenshot -> PASS/FAIL
26
+ ```
27
+
28
+ PASS 必须写明断言到的变更值,以及从页面、列表、详情、API 响应、存储记录或日志中的哪个位置回读。
29
+
30
+ ## 矩阵字段
31
+
32
+ `web-browser` 行必须包含:
33
+
34
+ - `执行面`:`web-browser`
35
+ - `验收模式`:`instant-acceptance`、`durable-regression` 或 `visual-ai-assist`
36
+ - `证据层级`:`browser-acceptance`、`e2e`、`visual-acceptance`、`integration` 或 `smoke`
37
+ - `框架/命令`:MCP、Playwright CLI、`npx playwright test`、项目 E2E 命令或 Midscene 路由
38
+ - `必需证据`:snapshot、截图、提交后断言、report/trace、console/network 记录或 Midscene 报告
39
+
40
+ 如果一个功能同时需要现场验收和稳定回归,拆成两条矩阵行。
@@ -5,7 +5,9 @@
5
5
  - 意图:
6
6
  - 背景:
7
7
  - 执行角色:
8
- - 执行界面:
8
+ - 执行面: web-browser | android-app | desktop-gui | api
9
+ - 验收模式:
10
+ - 证据层级:
9
11
  - 触发/输入:
10
12
  - 期望反馈位置:
11
13
  - status: pending
@@ -0,0 +1,44 @@
1
+ # API 验收
2
+
3
+ ## ACC-API-001
4
+
5
+ - 执行面: api
6
+ - 验收模式: n/a
7
+ - 工具路线: 项目 API 命令 | pytest + httpx/requests | curl/httpie | Postman/Newman | 契约工具
8
+ - 证据层级: contract | integration | smoke | security-review
9
+ - base URL:
10
+ - auth/role:
11
+ - fixture/seed:
12
+ - teardown:
13
+ - 状态: pending
14
+
15
+ ### 请求
16
+
17
+ - method:
18
+ - path:
19
+ - headers:
20
+ - query:
21
+ - body:
22
+
23
+ ### 期望响应
24
+
25
+ - status code:
26
+ - headers:
27
+ - schema/source:
28
+ - payload 断言:
29
+ - error contract:
30
+
31
+ ### 回读契约
32
+
33
+ - API 查询 endpoint:
34
+ - DB/存储/日志/事件断言:
35
+ - 幂等/retry 断言:
36
+ - cleanup 断言:
37
+
38
+ ### 证据
39
+
40
+ - 状态:
41
+ - 请求/响应记录:
42
+ - 报告路径:
43
+ - 产物:
44
+ - 阻塞项:
@@ -0,0 +1,43 @@
1
+ # 桌面 GUI 验收
2
+
3
+ ## ACC-Desktop-001
4
+
5
+ - 执行面: desktop-gui
6
+ - 验收模式: n/a
7
+ - 工具路线: 项目 GUI 自动化 | @midscene/computer | 可访问性/窗口元数据 | 脚本化人工 GUI 验收
8
+ - 证据层级: gui-acceptance | visual-acceptance | integration | smoke
9
+ - 目标 App/窗口:
10
+ - 启动命令:
11
+ - fixture/reset:
12
+ - 状态: pending
13
+
14
+ ### 环境
15
+
16
+ - OS/显示器/RDP:
17
+ - 模型环境状态:
18
+ - App 版本/build:
19
+ - 目标进程/窗口元数据:
20
+
21
+ ### 步骤
22
+
23
+ 1.
24
+
25
+ ### 期望结果
26
+
27
+ -
28
+
29
+ ### 回读契约
30
+
31
+ - 持久化结果面:
32
+ - 重开/重启检查:
33
+ - 可访问性/窗口元数据断言:
34
+ - 文件/配置/App 状态断言:
35
+
36
+ ### 证据
37
+
38
+ - 状态:
39
+ - 截图/录屏:
40
+ - GUI 操作日志:
41
+ - 窗口/App 元数据:
42
+ - Midscene/computer 报告或日志:
43
+ - 阻塞项:
@@ -1,13 +1,14 @@
1
1
  # 验收到测试矩阵
2
2
 
3
- | ID | 意图 | 覆盖维度 | 触发/输入 | 期望行为 | 风险 | 证据层级 | 框架/命令 | 必需证据 | 缺口/阻塞 | 状态 |
4
- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
5
- | ACC-001 | 新增成功 | 新增 | 有效 fixture 实体 | 创建成功,并能在列表/详情中看到 | high | integration + acceptance | `python -m pytest` + 真实工作流 | 新增证据、UI/API/DB 断言、使用的测试数据 | 无 | pending |
6
- | ACC-002 | 查询/列表/详情成功 | 查询/列表/详情 | seed 的实体 | 列表、搜索/筛选、详情显示正确数据 | high | integration + acceptance | `python -m pytest` + 真实工作流 | 查询/列表/详情证据和数据一致性检查 | 无 | pending |
7
- | ACC-003 | 修改成功 | 修改 | 编辑 fixture 实体 | 保存后回读仍是新值 | high | integration + acceptance | `python -m pytest` + 真实工作流 | 修改证据和回读断言 | 无 | pending |
8
- | ACC-004 | 删除安全成功 | 删除 | 已存在 fixture 实体 | 删除确认/取消正确;确认删除后不可见 | high | integration + acceptance | `python -m pytest` + 真实工作流 | 删除证据、取消证据、删除后回读检查 | | pending |
9
- | ACC-005 | 失败/边界路径可控 | 失败/边界 | 非法、空、重复、无权限或过期 fixture 数据 | 给出清晰反馈且不污染数据 | high | unit/integration/acceptance | `python -m pytest` + 验收 | 校验、权限、重复提交、过期状态证据 | | pending |
10
- | ACC-006 | 数据一致性成立 | 数据一致性 | 新增/修改/删除闭环 | UI、API、数据库/存储、文件和日志一致 | high | integration | 项目命令或 `python -m pytest` | 跨界面一致性证据 | | pending |
11
- | ACC-007 | 端到端 CRUD 链路可用 | 端到端 CRUD | 新增 -> 列表 -> 详情 -> 修改 -> 回读 -> 删除 | 完整用户链路通过并留下干净状态 | high | E2E/acceptance | 浏览器/API 工作流 | 全链路步骤、截图/日志、清理证据 | 无 | pending |
12
- | ACC-008 | 冒烟质量门通过 | 冒烟 | 应用启动且核心入口可访问 | 核心路由/API/CRUD 主路径不崩 | high | smoke | 项目冒烟命令或 targeted workflow | smoke_report 路径 | | pending |
13
- | ACC-009 | pre-push 质量门通过 | pre-push | push staged change | format/lint/type/unit/integration/smoke/diff 检查通过,否则阻止 push | high | pre-push | 项目命令序列 | pre_push_report 路径 | 无 | pending |
3
+ | ID | 需求来源 | 意图 | 执行面 | 验收模式 | 覆盖维度 | 触发/输入 | 期望行为 | 风险 | 证据层级 | 框架/命令 | 必需证据 | 缺口/阻塞 | 状态 |
4
+ | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
5
+ | ACC-001 | REQ-001 / 用户故事 | Web UI 新增成功 | web-browser | instant-acceptance | 新增 | 有效 fixture 实体 | 创建成功,并能在列表/详情中看到 | high | browser-acceptance + integration | Playwright MCP / Playwright CLI + 项目命令 | 新增证据、UI/API/DB 断言、使用的测试数据 | 无 | pending |
6
+ | ACC-002 | REQ-WEB-REG-001 / 回归需求 | Web CRUD 有稳定回归 | web-browser | durable-regression | 查询/列表/详情 + 端到端 CRUD | 已提交 E2E 测试 | 新增 -> 列表 -> 详情 -> 修改 -> 回读 -> 删除 可重复验证 | high | e2e | `npx playwright test` 或项目 E2E 命令 | 测试文件、trace/report、稳定 locator 断言 | 无 | pending |
7
+ | ACC-003 | REQ-WEB-VIS-001 / 视觉风险 | Web 视觉状态可验证 | web-browser | visual-ai-assist | 视觉行为 | 弱选择器或 canvas UI | Midscene 辅助定位 UI,确定性回读证明结果 | medium | visual-acceptance | Midscene + Playwright 路由 | Midscene 报告、截图、回读断言结果 | 无 | pending |
8
+ | ACC-004 | REQ-ANDROID-001 / 移动端流程 | Android App 新增成功 | android-app | n/a | 新增 | APK 已安装到模拟器/真机 | 任务创建成功,刷新后仍可见 | high | visual-acceptance + e2e | `android-midscene-pytest` / `python -m pytest tests_py -v` | pytest 报告、ADB 冒烟、Midscene HTML 报告、截图、logcat、`midscene_run` 日志 | ADB/APK/设备/package/模型环境变量时阻塞 | pending |
9
+ | ACC-005 | REQ-DESKTOP-001 / 设置流程 | 桌面设置保存成功 | desktop-gui | n/a | 修改 | 桌面应用窗口已打开 | 设置保存并在重开后仍生效 | high | gui-acceptance + integration | `opentest-desktop-gui` / 项目 GUI 自动化 / `@midscene/computer` | 截图或录屏、GUI 操作日志、App/窗口元数据、确定性回读、使用 Midscene/computer 时的报告 | display/RDP/App 启动/窗口标识/模型环境变量/结果面时阻塞 | pending |
10
+ | ACC-006 | REQ-API-001 / 契约 | API 新增成功 | api | n/a | 新增 | 合法请求 payload | 响应状态码和 payload 证明实体已创建 | high | contract + integration | `opentest-api` / 项目 API 命令 / `python -m pytest tests/api -v` | 请求/响应记录、状态码、payload/schema 断言、写后读、数据一致性、cleanup/teardown | base URL/auth/fixture/seed/teardown/依赖/schema/结果面时阻塞 | pending |
11
+ | ACC-007 | 风险:非法和无权限输入 | 失败/边界路径可控 | api | n/a | 失败/边界 | 非法、空、重复、未登录、无权限、过期或 stale fixture 数据 | 给出清晰错误契约且不污染数据 | high | contract + security-review | `opentest-api` / 项目命令 / `python -m pytest tests/api -v` | 校验、鉴权/权限、重复/幂等、stale-state、错误 schema、敏感字段证据 | 无 | pending |
12
+ | ACC-007A | 风险:列表契约漂移 | API 列表/搜索行为稳定 | api | n/a | 列表/过滤/排序/分页 | seeded collection 和 query params | 分页、过滤、排序、空结果符合契约 | medium | contract + integration | `opentest-api` / 项目 API 命令 | 请求/响应记录、schema 断言、分页元数据、fixture 隔离 | 未改列表 endpoint 时不适用 | pending |
13
+ | ACC-008 | 质量门需求 | 冒烟质量门通过 | web-browser | instant-acceptance | 冒烟 | 应用启动且核心入口可访问 | 核心路由/API/CRUD 主路径不崩 | high | smoke | 项目冒烟命令或 targeted workflow | smoke_report 路径 | 无 | pending |
14
+ | ACC-009 | 交付门禁需求 | pre-push 质量门通过 | api | n/a | pre-push | push 前 staged change | format/lint/type/unit/integration/smoke/diff 检查通过,否则阻止 push | high | pre-push | 项目命令序列 | pre_push_report 路径 | 无 | pending |
@@ -24,5 +24,5 @@
24
24
 
25
25
  ## 证据计划
26
26
 
27
- | 证据层级 | 适用场景 | 命令或执行面 | 产物路径 | 状态 |
28
- | --- | --- | --- | --- | --- |
27
+ | 执行面 | 验收模式 | 证据层级 | 适用场景 | 命令/工具 | 产物路径 | 状态 |
28
+ | --- | --- | --- | --- | --- | --- | --- |
@@ -0,0 +1,27 @@
1
+ # Web 浏览器验收
2
+
3
+ - ACC ID:
4
+ - 执行面: web-browser
5
+ - 验收模式: instant-acceptance | durable-regression | visual-ai-assist
6
+ - 工具路由: Playwright MCP | Playwright CLI | @playwright/test | Midscene
7
+ - 页面/路由:
8
+ - 执行角色:
9
+ - fixture:
10
+
11
+ ## 操作步骤
12
+
13
+ 1. open:
14
+ 2. snapshot:
15
+ 3. fill/input:
16
+ 4. submit/confirm:
17
+ 5. submit 后 snapshot:
18
+ 6. read/assert changed result:
19
+ 7. screenshot/report:
20
+
21
+ ## 证据
22
+
23
+ - status:
24
+ - 已断言的变更结果:
25
+ - 产物路径:
26
+ - console/network 记录:
27
+ - blocked 原因:
@@ -11,13 +11,22 @@ description: "OpenTest 阶段 4:执行自然语言验收、MCP 验收或真实
11
11
 
12
12
  - `opentest/references/acceptance-evidence.md`
13
13
  - `opentest/references/complete-testing-workflow.md`
14
+ - `opentest/references/test-surfaces.md`
15
+ - `opentest/references/web-browser-testing.md`
16
+ - `opentest/references/desktop-gui-testing.md`
17
+ - `opentest/references/api-testing.md`
14
18
  - `opentest/templates/acceptance-template.md`
19
+ - `opentest/templates/desktop-gui-acceptance-template.md`
20
+ - `opentest/templates/api-acceptance-template.md`
15
21
 
16
22
  ## 步骤
17
23
 
18
24
  1. 读取矩阵、fixtures 和 `docs/opentest/acceptance/`。
19
- 2. 前端交互优先用 Chrome DevTools MCP 执行真实页面验收。
20
- 3. API/后台链路使用项目命令或直接 API 检查。
21
- 4. CRUD/数据变更执行 workflow 引用中的完整链路。
22
- 5. 记录反馈位置/形态、产物、blocked evidence 和对应 ACC ID
23
- 6. 更新验收记录并运行 `bash "$OPENTEST_GUARD" accept --apply`。
25
+ 2. 根据矩阵里的执行面选择验收工具。
26
+ 3. `web-browser` 使用 `opentest-web-browser`:优先 Playwright MCP,失败时降级 Playwright CLI;稳定回归证据用 `@playwright/test`;视觉补充才用 Midscene。
27
+ 4. `android-app` 已安装 `android-midscene-pytest` 时使用它;入口是 `python -m pytest tests_py -v`,收集 pytest、ADB 冒烟、Midscene HTML、截图、logcat、设备/App 元数据和可用的 `midscene_run` 日志。缺 ADB、模拟器/真机、APK、package 或模型凭据时标为 blocked。
28
+ 5. `desktop-gui` 使用 `opentest-desktop-gui`:优先项目 GUI 自动化,视觉桌面/原生/RDP 流程用 `@midscene/computer`,并收集截图或录屏、GUI 操作日志、窗口/App 元数据和确定性回读。缺 display/RDP、App 启动、目标窗口标识、模型凭据或稳定结果面时标为 blocked
29
+ 6. `api` 使用 `opentest-api`:优先项目 API 命令;否则用 `pytest` + `httpx`/`requests`、schema 校验、fixtures、写后读和 cleanup/teardown 证据。
30
+ 7. CRUD/数据变更执行 workflow 引用中的完整链路。
31
+ 8. 记录反馈位置/形态、产物、blocked evidence 和对应 ACC ID。
32
+ 9. 更新验收记录并运行 `bash "$OPENTEST_GUARD" accept --apply`。
@@ -0,0 +1,25 @@
1
+ ---
2
+ name: opentest-api
3
+ description: "OpenTest 的 API 执行面适配器。用于 HTTP API、RPC、后端工作流、契约、鉴权、数据一致性、幂等和集成证据的规划、编写、运行与验收。"
4
+ ---
5
+
6
+ # OpenTest API
7
+
8
+ 用于矩阵中的 `api` 执行面。
9
+
10
+ ## 必读引用
11
+
12
+ - `opentest/references/api-testing.md`
13
+ - `opentest/templates/api-acceptance-template.md`
14
+
15
+ ## 路由
16
+
17
+ 1. 仓库已有明确、可重复的 API/integration 测试命令时,优先使用项目命令。
18
+ 2. 没有项目命令时,默认用 `pytest` 编排,`httpx` 或 `requests` 发请求,`jsonschema` 或项目已有 Pydantic/DTO 模型做 schema 校验,fixtures 管 seed/teardown。
19
+ 3. 有 OpenAPI、protobuf 或既有契约文档时,把它们作为契约来源;否则在验收用例里写清 expected status、headers、response schema 和业务 payload。
20
+ 4. 第三方 API 默认 mock/stub;只有需求明确要求真实外部依赖时才打 live 服务。
21
+ 5. 缺 base URL、auth token、fixture 数据、seed/teardown、依赖服务或稳定回读结果面时,记录 `blocked`。
22
+
23
+ ## 证据契约
24
+
25
+ PASS 必须包含请求/响应记录、状态码、响应 payload 或 schema 断言、适用时的鉴权/权限结果、数据一致性/写后读证据,以及 cleanup 或 teardown 证明。API 冒烟只证明存活;对高风险变更,它不能替代契约、边界、权限或数据一致性证据。
@@ -11,14 +11,16 @@ description: "OpenTest 阶段 2:根据矩阵补齐测试资产、fixtures 和
11
11
 
12
12
  - `opentest/references/opentest-driven-development.md`
13
13
  - `opentest/references/complete-testing-workflow.md`
14
+ - `opentest/references/test-asset-layout.md`
14
15
  - `opentest/templates/fixtures-template.md`
15
16
  - `opentest/templates/acceptance-template.md`
16
17
 
17
18
  ## 步骤
18
19
 
19
20
  1. 读取 `.opentest.yaml` 的 `matrix` 和 `fixtures`。
20
- 2. 代码级证据优先用项目框架;没有框架时默认使用 pytest,测试放入 `tests/` 并可用 `python -m pytest` 运行。
21
- 3. 创建/更新 fixtures、seed、teardown、用户、角色、实体、文件/图片和断言界面。
22
- 4. CRUD/数据变更必须补全链路:新增 -> 列表 -> 详情 -> 修改 -> 回读 -> 删除 -> 确认消失 -> 清理。
23
- 5. 记录 gap/blocker 的原因和风险。
24
- 6. 写入 `.opentest.yaml` 的 `fixtures`、`acceptance`,再运行 `bash "$OPENTEST_GUARD" author --apply`。
21
+ 2. 保留每条矩阵行的需求来源和期望行为。不要围绕当前实现命名、组件内部结构或已有测试文件重写验收用例。
22
+ 3. 资产必须放入 `test-asset-layout.md` 的固定目录;没有项目框架时默认使用 pytest + `tests/`。实现缺失只表示证据 pending。
23
+ 4. 创建/更新 fixtures、seed、teardown、用户、角色、实体、文件/图片和断言界面。
24
+ 5. CRUD/数据变更必须补全链路:新增 -> 列表 -> 详情 -> 修改 -> 回读 -> 删除 -> 确认消失 -> 清理。
25
+ 6. 记录 gap/blocker 的原因和风险。
26
+ 7. 写入 `.opentest.yaml` 的 `fixtures`、`acceptance`,再运行 `bash "$OPENTEST_GUARD" author --apply`。
@@ -0,0 +1,24 @@
1
+ ---
2
+ name: opentest-desktop-gui
3
+ description: "OpenTest 的桌面 GUI 执行面适配器。用于原生桌面、Electron、Tauri、Windows、macOS、Linux 或 RDP 工作流验收,并在项目 GUI 自动化、@midscene/computer、可访问性元数据、截图和脚本化人工验收之间选择路线。"
4
+ ---
5
+
6
+ # OpenTest Desktop GUI
7
+
8
+ 用于矩阵中的 `desktop-gui` 执行面。
9
+
10
+ ## 必读引用
11
+
12
+ - `opentest/references/desktop-gui-testing.md`
13
+ - `opentest/templates/desktop-gui-acceptance-template.md`
14
+
15
+ ## 路由
16
+
17
+ 1. 如果仓库已有明确、可重复的 GUI 自动化命令,优先使用项目命令。
18
+ 2. 对视觉桌面自动化、弱选择器、原生控件、跨窗口流程,或没有确定性项目自动化的远程 Windows RDP,可使用 `@midscene/computer`。
19
+ 3. Electron 或 Tauri 如果能暴露浏览器上下文,DOM 可验证流程优先走 `web-browser` 或 Playwright;只有原生外壳、托盘、文件选择器、菜单、系统弹窗或多窗口行为才走 `desktop-gui`。
20
+ 4. 缺模型凭据、桌面访问、显示器/RDP、App 启动命令或稳定结果面时,记录 `blocked`,不得标 PASS。
21
+
22
+ ## 证据契约
23
+
24
+ PASS 必须包含执行步骤、截图或录屏、窗口/App 元数据、GUI 操作日志,以及写操作后的确定性回读结果。`@midscene/computer` 断言只能作为视觉辅助,不能替代持久化结果检查,例如重开设置页、读取文件/配置值、查询 App 状态面,或重启后确认窗口状态。
@@ -5,23 +5,29 @@ description: "OpenTest 阶段 1:分析变更、风险和项目事实,生成
5
5
 
6
6
  # OpenTest Plan
7
7
 
8
- 在实现前生成 `docs/opentest/plans/`、`docs/opentest/matrices/` 和测试数据计划。
8
+ 在实现前生成 plan、matrix 和测试数据计划。
9
9
 
10
10
  ## 必读引用
11
11
 
12
12
  - `opentest/references/codex-harness-coverage-heuristics.md`
13
13
  - `opentest/references/matrix-format.md`
14
14
  - `opentest/references/complete-testing-workflow.md`
15
+ - `opentest/references/test-asset-layout.md`
16
+ - `opentest/references/test-surfaces.md`
17
+ - `opentest/references/web-browser-testing.md`
18
+ - `opentest/references/desktop-gui-testing.md`
19
+ - `opentest/references/api-testing.md`
15
20
 
16
21
  ## 步骤
17
22
 
18
- 1. 读取项目规则、需求/设计/diff、现有命令和 detect 输出。
19
- 2. 判断风险、适用覆盖面、测试数据,以及代码测试使用项目框架还是默认 `pytest`。
23
+ 1. 读取规则、需求/设计/请求/diff、现有命令和 detect 输出。
24
+ 2. 把需求、流程、业务规则和风险当成验收来源;读取当前代码只用于发现项目事实,例如命令、路由、框架、fixtures 和 helper。
20
25
  3. 数据写入、API、表单、文件或有状态流程默认套用 CRUD 基线和测试数据要求。
21
- 4. 生成矩阵,包含覆盖维度、框架/命令、必需证据、缺口/阻塞和状态。
22
- 5. 写入 `.opentest.yaml` 的 `plan`、`matrix`、`fixtures`。
23
- 6. 如存在 handoff,同步 plan/matrix/fixtures 路径,然后运行 `bash "$OPENTEST_GUARD" plan --apply`。
26
+ 4. 分开判定执行面和证据层级。执行面只能是 `web-browser`、`android-app`、`desktop-gui` 或 `api`;Web 行必须写验收模式,原生桌面行用 `opentest-desktop-gui`,API 行用 `opentest-api`。
27
+ 5. 生成需求先行矩阵,包含来源、行为、执行面、验收模式、证据层级、命令/工具、证据、缺口/阻塞、状态和固定资产目录。
28
+ 6. 写入 `.opentest.yaml` 的 `plan`、`matrix`、`fixtures`。
29
+ 7. 如存在 handoff,同步 plan/matrix/fixtures 路径,然后运行 `bash "$OPENTEST_GUARD" plan --apply`。
24
30
 
25
31
  ## 质量门
26
32
 
27
- 每个适用行为、失败路径、边界和风险面都要有证据或明确 gap/blockerCRUD 基线和测试数据默认必需;不适用时必须在矩阵写明原因。
33
+ 每个行为、失败路径、边界和风险面都要有证据或 gap/blocker。每行必须引用需求来源,并包含执行面和证据层级;Web 行还要有验收模式。不得把 unit/component/integration/contract/smoke 当执行面。不得因为当前代码没有对应函数、组件、API 或测试文件就删除或缩小验收。CRUD 基线和测试数据默认必需;不适用时在矩阵写明原因。
@@ -11,6 +11,11 @@ description: "OpenTest 阶段 3:按 targeted、fast、full、ci-like 或 pre-p
11
11
 
12
12
  - `opentest/references/command-routing.md`
13
13
  - `opentest/references/complete-testing-workflow.md`
14
+ - `opentest/references/test-asset-layout.md`
15
+ - `opentest/references/test-surfaces.md`
16
+ - `opentest/references/web-browser-testing.md`
17
+ - `opentest/references/desktop-gui-testing.md`
18
+ - `opentest/references/api-testing.md`
14
19
 
15
20
  ## 模式
16
21
 
@@ -22,10 +27,11 @@ description: "OpenTest 阶段 3:按 targeted、fast、full、ci-like 或 pre-p
22
27
 
23
28
  ## 步骤
24
29
 
25
- 1. 读取 `run_mode`、矩阵、fixtures 和必需证据。
26
- 2. 优先使用项目命令;没有代码级命令时用 `python -m pytest`。
27
- 3. 覆盖率优先用 `python -m pytest --cov=. --cov-report=term-missing`。
28
- 4. 除非矩阵写明不适用,否则必须有冒烟证据。
29
- 5. `pre-push` 运行或记录 format/check、lint、type、unit、targeted integration、smoke、`git diff --check`。
30
- 6. 写入 `run_report`,必要时写入 `coverage_report`、`smoke_report`、`pre_push_report`。
31
- 7. 运行 `bash "$OPENTEST_GUARD" run --apply`。
30
+ 1. 读取 `run_mode`、矩阵、fixtures、必需证据和固定资产目录。
31
+ 2. 根据矩阵执行面和验收模式选择命令/工具:`web-browser` 走 MCP/CLI 或 `npx playwright test`,`android-app` 走 `python -m pytest tests_py -v`;只有模型环境变量齐全或排查 Midscene 层时才跑 `npm run test:android`;`desktop-gui` 走 `opentest-desktop-gui`、项目 GUI 自动化或 `@midscene/computer`,`api` 走 `opentest-api`、项目 API 命令或 `python -m pytest tests/api -v`。
32
+ 3. 优先使用项目命令;没有代码级命令时用 `python -m pytest`。
33
+ 4. 覆盖率优先用 `python -m pytest --cov=. --cov-report=term-missing`。
34
+ 5. 除非矩阵写明不适用,否则必须有冒烟证据。
35
+ 6. `pre-push` 运行或记录 format/check、lint、type、unit、targeted integration、smoke、`git diff --check`。
36
+ 7. 写入 `run_report`,必要时写入 `coverage_report`、`smoke_report`、`pre_push_report`。
37
+ 8. 运行 `bash "$OPENTEST_GUARD" run --apply`。
@@ -0,0 +1,26 @@
1
+ ---
2
+ name: opentest-web-browser
3
+ description: "OpenTest 的 Web 浏览器执行面适配器。用于浏览器页面验收、Web 回归测试规划,以及在 Playwright MCP、Playwright CLI、@playwright/test 和 Midscene 之间选择工具。"
4
+ ---
5
+
6
+ # OpenTest Web Browser
7
+
8
+ 用于矩阵中 `web-browser` 执行面的用例。
9
+
10
+ ## 必读引用
11
+
12
+ - `opentest/references/web-browser-testing.md`
13
+ - `opentest/references/complete-testing-workflow.md`
14
+ - `opentest/templates/web-acceptance-template.md`
15
+
16
+ ## 步骤
17
+
18
+ 1. 先判定 `验收模式`:`instant-acceptance`、`durable-regression` 或 `visual-ai-assist`。
19
+ 2. `instant-acceptance` 优先用 Playwright MCP;浏览器 MCP 不可用或不稳定时用 Playwright CLI。
20
+ 3. `durable-regression` 写入或运行 `@playwright/test`,或项目已有 E2E 框架。
21
+ 4. 只有视觉定位、弱选择器、canvas、跨 frame 等 selector 难以证明的界面,才使用 Midscene。
22
+ 5. 写操作必须执行完整链路:open -> snapshot -> fill/input -> submit -> snapshot -> read/assert changed result -> screenshot -> PASS/FAIL。
23
+
24
+ ## 质量门
25
+
26
+ MCP 或 Playwright CLI 证据只能证明本次现场验收,不等于稳定回归。没有提交到仓库的可重复测试、命令和报告路径时,不得把它当成 durable regression。Midscene 不能替代写后读断言。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pzy560117/opentest",
3
- "version": "0.1.9",
3
+ "version": "0.1.11",
4
4
  "description": "OpenTest quality evidence lifecycle skills for Codex",
5
5
  "keywords": [
6
6
  "opentest",