@pzy560117/opentest 0.1.3 → 0.1.5

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 (42) hide show
  1. package/README.md +57 -8
  2. package/assets/manifest.json +84 -27
  3. package/assets/skills/opentest/SKILL.md +44 -44
  4. package/assets/skills/opentest/references/codex-harness-coverage-heuristics.md +55 -55
  5. package/assets/skills/opentest/references/lifecycle.md +1 -1
  6. package/assets/skills/opentest/references/matrix-format.md +14 -14
  7. package/assets/skills/opentest/references/opentest-driven-development.md +32 -32
  8. package/assets/skills/opentest/templates/acceptance-template.md +1 -1
  9. package/assets/skills/opentest/templates/matrix-template.md +3 -3
  10. package/assets/skills/opentest/templates/plan-template.md +17 -17
  11. package/assets/skills/opentest/templates/report-template.md +1 -1
  12. package/assets/skills/opentest-accept/SKILL.md +13 -13
  13. package/assets/skills/opentest-archive/SKILL.md +2 -2
  14. package/assets/skills/opentest-author/SKILL.md +14 -14
  15. package/assets/skills/opentest-heal/SKILL.md +2 -2
  16. package/assets/skills/opentest-plan/SKILL.md +17 -17
  17. package/assets/skills/opentest-run/SKILL.md +16 -16
  18. package/assets/skills/opentest-verify/SKILL.md +11 -11
  19. package/assets/skills-zh/opentest/SKILL.md +93 -0
  20. package/assets/skills-zh/opentest/references/acceptance-evidence.md +27 -0
  21. package/assets/skills-zh/opentest/references/codex-harness-coverage-heuristics.md +83 -0
  22. package/assets/skills-zh/opentest/references/command-routing.md +9 -0
  23. package/assets/skills-zh/opentest/references/lifecycle.md +16 -0
  24. package/assets/skills-zh/opentest/references/matrix-format.md +27 -0
  25. package/assets/skills-zh/opentest/references/opentest-driven-development.md +48 -0
  26. package/assets/skills-zh/opentest/references/quality-gate.md +24 -0
  27. package/assets/skills-zh/opentest/templates/acceptance-template.md +32 -0
  28. package/assets/skills-zh/opentest/templates/archive-layout.md +14 -0
  29. package/assets/skills-zh/opentest/templates/matrix-template.md +6 -0
  30. package/assets/skills-zh/opentest/templates/plan-template.md +28 -0
  31. package/assets/skills-zh/opentest/templates/report-template.md +28 -0
  32. package/assets/skills-zh/opentest-accept/SKILL.md +25 -0
  33. package/assets/skills-zh/opentest-archive/SKILL.md +8 -0
  34. package/assets/skills-zh/opentest-author/SKILL.md +27 -0
  35. package/assets/skills-zh/opentest-heal/SKILL.md +8 -0
  36. package/assets/skills-zh/opentest-plan/SKILL.md +30 -0
  37. package/assets/skills-zh/opentest-run/SKILL.md +28 -0
  38. package/assets/skills-zh/opentest-verify/SKILL.md +24 -0
  39. package/bin/opentest.js +318 -29
  40. package/package.json +1 -1
  41. package/scripts/prepublish-check.js +105 -6
  42. package/scripts/smoke-test.js +493 -23
package/README.md CHANGED
@@ -26,25 +26,73 @@ requirement / design
26
26
 
27
27
  ## Install
28
28
 
29
- Install into the current project:
29
+ Install the package, then run the initializer from any project:
30
30
 
31
31
  ```bash
32
- npx @pzy560117/opentest install
32
+ npm install -g @pzy560117/opentest
33
+ opentest init
33
34
  ```
34
35
 
35
- Install globally for Codex:
36
+ `opentest init` lets you choose the target tool, language, project/global scope, and project path. This is the recommended path for Claude Code, Codex, Cursor, OpenCode, Gemini CLI, Qwen Code, and Qoder users.
37
+
38
+ You can still run fully scripted installs. For example, install Chinese OpenTest skills for Claude Code in the current project:
39
+
40
+ ```bash
41
+ opentest install --scope project --platform claude --language zh
42
+ ```
43
+
44
+ Install Chinese OpenTest skills for Qoder in a specific project:
36
45
 
37
46
  ```bash
38
- npx @pzy560117/opentest install --global
47
+ npx @pzy560117/opentest install --scope project --platform qoder --language zh --project /path/to/project
39
48
  ```
40
49
 
41
- Overwrite an existing OpenTest install:
50
+ Install Chinese OpenTest skills globally for Codex:
42
51
 
43
52
  ```bash
44
- npx @pzy560117/opentest install --force
53
+ npx @pzy560117/opentest install --scope global --platform codex --language zh
45
54
  ```
46
55
 
47
- Restart Codex or open a new session after installation so the new skills are loaded.
56
+ Legacy global install with overwrite:
57
+
58
+ ```bash
59
+ npx @pzy560117/opentest install --global --force
60
+ ```
61
+
62
+ Legacy project install with overwrite:
63
+
64
+ ```bash
65
+ npx @pzy560117/opentest install --project /path/to/project --force
66
+ ```
67
+
68
+ ### Install Options
69
+
70
+ | Option | Meaning | Default |
71
+ | --- | --- | --- |
72
+ | `--scope <project|global>` | Install into the selected project skills directory or the user's global skills directory. | `project` |
73
+ | `--platform <id>` | Target AI programming tool. Supported IDs are listed below and are read by the CLI from `assets/manifest.json`. | `codex` |
74
+ | `--language <en|zh>` | Skill language to install. `en` installs English skills; `zh` installs Chinese skills. | `en` |
75
+ | `--project <path>` | Project root used for project-scope installs. This also selects project scope for legacy compatibility. | Current working directory |
76
+ | `--global` | Legacy alias for `--scope global --platform codex`. | Disabled |
77
+ | `--force` | Overwrite existing manifest-managed OpenTest skill directories. | Disabled |
78
+
79
+ ### Supported Platforms
80
+
81
+ The CLI reads platform data directly from the package manifest at `assets/manifest.json`; the paths below are shown using project-relative and home-relative notation.
82
+
83
+ | Platform ID | Tool | Project skills directory | Global skills directory |
84
+ | --- | --- | --- | --- |
85
+ | `codex` | Codex | `.codex/skills` | `~/.codex/skills` |
86
+ | `claude` | Claude Code | `.claude/skills` | `~/.claude/skills` |
87
+ | `cursor` | Cursor | `.cursor/skills` | `~/.cursor/skills` |
88
+ | `opencode` | OpenCode | `.opencode/skills` | `~/.config/opencode/skills` |
89
+ | `gemini` | Gemini CLI | `.gemini/skills` | `~/.gemini/skills` |
90
+ | `qwen` | Qwen Code | `.qwen/skills` | `~/.qwen/skills` |
91
+ | `qoder` | Qoder | `.qoder/skills` | `~/.qoder/skills` |
92
+
93
+ When adding a platform, update at least `assets/manifest.json` and `scripts/smoke-test.js` in this package so the installer data and smoke coverage stay in sync. Update this README table in the same change.
94
+
95
+ Restart the target AI programming tool or open a new session after installation so the new skills are loaded.
48
96
 
49
97
  ## Included Skills
50
98
 
@@ -59,6 +107,7 @@ Restart Codex or open a new session after installation so the new skills are loa
59
107
 
60
108
  ## Package Contents
61
109
 
62
- - `assets/skills/`: Codex skill files
110
+ - `assets/skills/`: English skill files
111
+ - `assets/skills-zh/`: Chinese skill files
63
112
  - `assets/manifest.json`: published asset manifest
64
113
  - `bin/opentest.js`: installer CLI
@@ -1,31 +1,88 @@
1
1
  {
2
- "version": "0.1.3",
3
- "skills": [
4
- "opentest/SKILL.md",
5
- "opentest/scripts/opentest-state.sh",
6
- "opentest/scripts/opentest-detect.sh",
7
- "opentest/scripts/opentest-guard.sh",
8
- "opentest/references/lifecycle.md",
9
- "opentest/references/matrix-format.md",
10
- "opentest/references/quality-gate.md",
11
- "opentest/references/acceptance-evidence.md",
12
- "opentest/references/command-routing.md",
13
- "opentest/references/codex-harness-coverage-heuristics.md",
14
- "opentest/references/opentest-driven-development.md",
15
- "opentest/templates/plan-template.md",
16
- "opentest/templates/matrix-template.md",
17
- "opentest/templates/acceptance-template.md",
18
- "opentest/templates/report-template.md",
19
- "opentest/templates/archive-layout.md",
20
- "opentest-plan/SKILL.md",
21
- "opentest-author/SKILL.md",
22
- "opentest-run/SKILL.md",
23
- "opentest-accept/SKILL.md",
24
- "opentest-verify/SKILL.md",
25
- "opentest-heal/SKILL.md",
26
- "opentest-archive/SKILL.md"
2
+ "version": "0.1.5",
3
+ "languages": [
4
+ {
5
+ "id": "en",
6
+ "name": "English",
7
+ "skillsDir": "skills"
8
+ },
9
+ {
10
+ "id": "zh",
11
+ "name": "中文",
12
+ "skillsDir": "skills-zh"
13
+ }
27
14
  ],
28
15
  "platforms": [
29
- { "id": "codex", "skillsDir": ".codex/skills" }
30
- ]
16
+ {
17
+ "id": "codex",
18
+ "name": "Codex",
19
+ "projectSkillsDir": ".codex/skills",
20
+ "globalSkillsDir": "~/.codex/skills"
21
+ },
22
+ {
23
+ "id": "claude",
24
+ "name": "Claude Code",
25
+ "projectSkillsDir": ".claude/skills",
26
+ "globalSkillsDir": "~/.claude/skills"
27
+ },
28
+ {
29
+ "id": "cursor",
30
+ "name": "Cursor",
31
+ "projectSkillsDir": ".cursor/skills",
32
+ "globalSkillsDir": "~/.cursor/skills"
33
+ },
34
+ {
35
+ "id": "opencode",
36
+ "name": "OpenCode",
37
+ "projectSkillsDir": ".opencode/skills",
38
+ "globalSkillsDir": ".config/opencode/skills"
39
+ },
40
+ {
41
+ "id": "gemini",
42
+ "name": "Gemini CLI",
43
+ "projectSkillsDir": ".gemini/skills",
44
+ "globalSkillsDir": "~/.gemini/skills"
45
+ },
46
+ {
47
+ "id": "qwen",
48
+ "name": "Qwen Code",
49
+ "projectSkillsDir": ".qwen/skills",
50
+ "globalSkillsDir": "~/.qwen/skills"
51
+ },
52
+ {
53
+ "id": "qoder",
54
+ "name": "Qoder",
55
+ "projectSkillsDir": ".qoder/skills",
56
+ "globalSkillsDir": "~/.qoder/skills"
57
+ }
58
+ ],
59
+ "managedFiles": {
60
+ "localized": [
61
+ "opentest/SKILL.md",
62
+ "opentest/references/acceptance-evidence.md",
63
+ "opentest/references/codex-harness-coverage-heuristics.md",
64
+ "opentest/references/command-routing.md",
65
+ "opentest/references/lifecycle.md",
66
+ "opentest/references/matrix-format.md",
67
+ "opentest/references/opentest-driven-development.md",
68
+ "opentest/references/quality-gate.md",
69
+ "opentest/templates/acceptance-template.md",
70
+ "opentest/templates/archive-layout.md",
71
+ "opentest/templates/matrix-template.md",
72
+ "opentest/templates/plan-template.md",
73
+ "opentest/templates/report-template.md",
74
+ "opentest-accept/SKILL.md",
75
+ "opentest-archive/SKILL.md",
76
+ "opentest-author/SKILL.md",
77
+ "opentest-heal/SKILL.md",
78
+ "opentest-plan/SKILL.md",
79
+ "opentest-run/SKILL.md",
80
+ "opentest-verify/SKILL.md"
81
+ ],
82
+ "shared": [
83
+ "opentest/scripts/opentest-state.sh",
84
+ "opentest/scripts/opentest-detect.sh",
85
+ "opentest/scripts/opentest-guard.sh"
86
+ ]
87
+ }
31
88
  }
@@ -1,93 +1,93 @@
1
1
  ---
2
2
  name: opentest
3
- description: "OpenTest 路由入口。自动检测 .opentest.yaml、初始化测试生命周期状态,并分发到 plan/author/run/accept/verify/heal/archive 阶段。"
3
+ description: "OpenTest router. Detects .opentest.yaml, initializes test lifecycle state, and dispatches to plan/author/run/accept/verify/heal/archive phases."
4
4
  ---
5
5
 
6
- # OpenTest 路由入口
6
+ # OpenTest Router
7
7
 
8
- OpenTest 是面向 AI 编程变更的测试决策与质量证据生命周期。它不是单纯的 TDD 包装,也不是只在实现结束后跑命令;它应在实现前先把显性需求、隐性边界、失败路径、交互反馈和风险场景整理成测试矩阵,再用矩阵驱动代码、验收和质量门。
8
+ OpenTest is a test decision and quality evidence lifecycle for AI coding changes. It is not just a TDD wrapper, and it is not just a command runner at the end of implementation. Before implementation, it turns explicit requirements, implicit boundaries, failure paths, interaction feedback, and risk scenarios into a test matrix, then uses that matrix to drive code, acceptance, and quality gates.
9
9
 
10
- ## 产出语言契约
10
+ ## Output Language Contract
11
11
 
12
- - 面向用户输出和生成文档默认使用中文。
13
- - 命令、路径、frontmatter key、代码标识符和 API 名称保持原文。
12
+ - User-facing output and generated documents default to English.
13
+ - Commands, paths, frontmatter keys, code identifiers, and API names stay as written.
14
14
 
15
- ## Step 0: 定位脚本
15
+ ## Step 0: Locate Scripts
16
16
 
17
- 运行:
17
+ Run:
18
18
 
19
19
  ```bash
20
- OPENTEST_SEARCH_ROOTS=("." "$HOME/.claude/skills" "$HOME/.codex/skills" "$HOME/.cursor/skills")
20
+ OPENTEST_SEARCH_ROOTS=("." ".codex/skills" ".claude/skills" ".cursor/skills" ".opencode/skills" ".gemini/skills" ".qwen/skills" ".qoder/skills" "$HOME/.codex/skills" "$HOME/.claude/skills" "$HOME/.cursor/skills" "$HOME/.config/opencode/skills" "$HOME/.gemini/skills" "$HOME/.qwen/skills" "$HOME/.qoder/skills")
21
21
  OPENTEST_STATE="${OPENTEST_STATE:-$(find "${OPENTEST_SEARCH_ROOTS[@]}" -path '*/opentest/scripts/opentest-state.sh' -type f -print -quit 2>/dev/null)}"
22
22
  OPENTEST_GUARD="${OPENTEST_GUARD:-$(find "${OPENTEST_SEARCH_ROOTS[@]}" -path '*/opentest/scripts/opentest-guard.sh' -type f -print -quit 2>/dev/null)}"
23
23
  OPENTEST_DETECT="${OPENTEST_DETECT:-$(find "${OPENTEST_SEARCH_ROOTS[@]}" -path '*/opentest/scripts/opentest-detect.sh' -type f -print -quit 2>/dev/null)}"
24
24
  ```
25
25
 
26
- 若任一脚本缺失,停止并提示安装或复制 OpenTest 分发包。
26
+ If any script is missing, stop and ask the user to install or copy the OpenTest distribution.
27
27
 
28
- ## Step 1: 状态检测
28
+ ## Step 1: Detect State
29
29
 
30
- 如果存在 `docs/loop-handoff/latest.md`,先读取 handoff,确认上次 OpenTest 阶段、矩阵/验收/报告路径、阻塞项和下一步。handoff 只作为恢复线索,不替代 `.opentest.yaml`。
30
+ If `docs/loop-handoff/latest.md` exists, read it first to recover the previous OpenTest phase, matrix/acceptance/report paths, blockers, and next step. The handoff is only a recovery hint; it does not replace `.opentest.yaml`.
31
31
 
32
- 如果 `.opentest.yaml` 不存在,运行:
32
+ If `.opentest.yaml` does not exist, run:
33
33
 
34
34
  ```bash
35
35
  bash "$OPENTEST_STATE" init
36
36
  ```
37
37
 
38
- 然后运行:
38
+ Then run:
39
39
 
40
40
  ```bash
41
41
  bash "$OPENTEST_STATE" check
42
42
  bash "$OPENTEST_DETECT" summary
43
43
  ```
44
44
 
45
- ## Step 2: 阶段分发
45
+ ## Step 2: Dispatch Phase
46
46
 
47
- 读取 `phase`:
47
+ Read `phase`:
48
48
 
49
49
  ```bash
50
50
  bash "$OPENTEST_STATE" get phase
51
51
  ```
52
52
 
53
- 分发规则:
53
+ Dispatch rules:
54
54
 
55
- - `archived: true`:报告 OpenTest 已完成。
56
- - `phase: plan`:调用 `opentest-plan`。
57
- - `phase: author`:调用 `opentest-author`。
58
- - `phase: run`:调用 `opentest-run`。
59
- - `phase: accept`:调用 `opentest-accept`。
60
- - `phase: verify`:调用 `opentest-verify`。
61
- - `phase: heal`:调用 `opentest-heal`。
62
- - `phase: archive`:调用 `opentest-archive`。
55
+ - `archived: true`: report that OpenTest is complete.
56
+ - `phase: plan`: invoke `opentest-plan`.
57
+ - `phase: author`: invoke `opentest-author`.
58
+ - `phase: run`: invoke `opentest-run`.
59
+ - `phase: accept`: invoke `opentest-accept`.
60
+ - `phase: verify`: invoke `opentest-verify`.
61
+ - `phase: heal`: invoke `opentest-heal`.
62
+ - `phase: archive`: invoke `opentest-archive`.
63
63
 
64
- 若状态与可验证文件冲突,以文件状态为准,并用 `opentest-state.sh set` 修正;如存在 handoff,也同步更新 handoff 的“当前阶段/下一步/失败阻塞”。
64
+ If state conflicts with verifiable files, trust the files and repair state with `opentest-state.sh set`. If a handoff exists, also update its current phase, next step, failures, and blockers.
65
65
 
66
- ## OpenTest-Driven Development 用法
66
+ ## OpenTest-Driven Development Usage
67
67
 
68
- 当用户想“以测试驱动开发”、需求包含前端交互、登录、表单、权限、API、数据写入、跨页面流程或高风险行为时,OpenTest 必须前置到 build 之前:
68
+ When the user wants test-driven development, or when the requirement includes frontend interactions, login, forms, permissions, APIs, data writes, cross-page flows, or high-risk behavior, OpenTest must run before build work:
69
69
 
70
70
  ```text
71
- 需求 / OpenSuper design
72
- -> opentest plan # 隐性场景挖掘 + acceptance-to-test matrix
73
- -> opentest author # 测试资产 / 自然语言验收用例
74
- -> build # 按矩阵实现
75
- -> opentest run # unit / integration / smoke / e2e 命令
76
- -> opentest accept # 真实页面、API 或链路验收
77
- -> opentest verify # 质量门报告
71
+ Requirement / OpenSuper design
72
+ -> opentest plan # implicit scenario mining + acceptance-to-test matrix
73
+ -> opentest author # test assets / natural language acceptance cases
74
+ -> build # implement against the matrix
75
+ -> opentest run # unit / integration / smoke / e2e commands
76
+ -> opentest accept # real page, API, or workflow acceptance
77
+ -> opentest verify # quality gate report
78
78
  ```
79
79
 
80
- `plan` 阶段不能只复述需求。它必须主动检查:
80
+ The `plan` phase must not merely restate requirements. It must actively inspect:
81
81
 
82
- - 主路径、失败路径、边界输入、空数据、权限、网络、重复提交、并发或过期状态。
83
- - 前端反馈位置:字段下方、表单顶部、toastmodalinline status、页面错误态。
84
- - 证据分层:unitcomponentintegrationcontractE2Esmokevisual/browser acceptancesecurity/review
85
- - 哪些证据是必需,哪些是不适用,哪些是 gap risk-accepted 候选。
82
+ - Happy paths, failure paths, boundary inputs, empty data, permissions, network failures, duplicate submissions, concurrency, and stale state.
83
+ - Frontend feedback location: field-level message, form-level alert, toast, modal, inline status, or page error state.
84
+ - Evidence layers: unit, component, integration, contract, E2E, smoke, visual/browser acceptance, and security/review.
85
+ - Which evidence is required, which is not applicable, and which is a gap or risk-accepted candidate.
86
86
 
87
- 实现完成后,`OpenSuper verify` 可以引用 OpenTest verification report,但不能替代 OpenTest 的矩阵、运行记录和验收证据。
87
+ After implementation, `OpenSuper verify` may reference the OpenTest verification report, but it does not replace the OpenTest matrix, run records, or acceptance evidence.
88
88
 
89
- ## Loop Handoff 衔接
89
+ ## Loop Handoff Integration
90
90
 
91
- OpenTest 每完成 `plan`、`author`、`run`、`accept`、`verify` 任一阶段后,应更新 `docs/loop-handoff/latest.md`,至少记录 `.opentest.yaml` 路径、当前阶段、测试资产路径、已运行验证、未运行验证、失败/阻塞和下一步。
91
+ After OpenTest completes any `plan`, `author`, `run`, `accept`, or `verify` phase, update `docs/loop-handoff/latest.md` when the project uses Loop Handoff. At minimum, record the `.opentest.yaml` path, current phase, test asset paths, verification already run, verification not run, failures/blockers, and next step.
92
92
 
93
- `opentest-verify` 生成的 verification report 路径必须写入 handoff,方便 OpenSuper verify 或新会话恢复时直接引用。
93
+ The verification report path produced by `opentest-verify` must be written to the handoff so OpenSuper verify or a resumed session can reference it directly.
@@ -1,14 +1,14 @@
1
- # Codex Harness 覆盖启发参考
1
+ # Codex Harness Coverage Heuristics
2
2
 
3
- ## 用途
3
+ ## Purpose
4
4
 
5
- 本文件随 OpenTest 分发,用于给 `/opentest-plan` `/opentest-accept` 提供轻量覆盖启发。它不是强制 checklist,也不是 Codex Harness 全量内容副本。
5
+ This file ships with OpenTest to provide lightweight coverage heuristics for `/opentest-plan` and `/opentest-accept`. It is not a mandatory checklist and is not a full copy of Codex Harness content.
6
6
 
7
- OpenTest 应根据变更类型、风险和项目事实选择适用覆盖面。适用但缺少证据的点应记录为 `gap`;不适用的点应在覆盖摘要中说明,不需要展开用例。
7
+ OpenTest should select applicable coverage from the change type, risk, and project facts. Applicable coverage without evidence should be recorded as `gap`. Non-applicable coverage should be briefly explained in the coverage summary and does not need expanded cases.
8
8
 
9
- ## 来源
9
+ ## Sources
10
10
 
11
- 本参考从本地 Codex Harness 知识库中抽取短规则,主要对应:
11
+ This reference extracts short rules from the local Codex Harness knowledge base, primarily corresponding to:
12
12
 
13
13
  - `tdd-workflow`
14
14
  - `e2e-runner`
@@ -17,67 +17,67 @@ OpenTest 应根据变更类型、风险和项目事实选择适用覆盖面。
17
17
  - `code-reviewer`
18
18
  - `speckit-checklist`
19
19
 
20
- ## 选择规则
20
+ ## Selection Rules
21
21
 
22
- | 变更类型 | 默认考虑的证据 |
22
+ | Change type | Default evidence to consider |
23
23
  | --- | --- |
24
- | 纯函数、工具函数、状态计算 | unit evidence |
25
- | 服务、模块协作、数据库读写 | integration evidence |
26
- | API、契约、错误处理 | contractintegrationerror evidence |
27
- | 前端渲染或交互 | UI acceptance,必要时 component E2E evidence |
28
- | 权限、支付、安全、数据写入、跨页面闭环 | high-risk acceptance E2E evidence |
29
- | 文案、配置、小范围无行为变更 | targeted review light evidence |
24
+ | Pure functions, utility functions, state calculation | unit evidence |
25
+ | Services, module collaboration, database reads/writes | integration evidence |
26
+ | APIs, contracts, error handling | contract, integration, error evidence |
27
+ | Frontend rendering or interaction | UI acceptance, plus component or E2E evidence when needed |
28
+ | Permissions, payments, security, data writes, cross-page loops | high-risk acceptance or E2E evidence |
29
+ | Copy, configuration, small non-behavioral changes | targeted review or light evidence |
30
30
 
31
- ## 前端验收维度
31
+ ## Frontend Acceptance Dimensions
32
32
 
33
- 前端或真实链路验收可从以下维度中选择适用项,不要求每次全部覆盖:
33
+ Frontend or real workflow acceptance may choose applicable items from the following dimensions. Full coverage is not required every time:
34
34
 
35
- | 维度 | 含义 |
35
+ | Dimension | Meaning |
36
36
  | --- | --- |
37
- | D1 页面渲染 | 标题、文案、结构、主要元素存在 |
38
- | D2 交互功能 | 点击、输入、选择、弹窗、菜单 |
39
- | D3 数据展示 | API 数据、格式化、状态展示 |
40
- | D4 表单验证 | 必填、格式、边界、关联校验 |
41
- | D5 导航流转 | 菜单、链接、返回、跨页面传参 |
42
- | D6 状态管理 | loadingemptyerrorretry |
43
- | D7 权限控制 | 角色、路由守卫、越权拦截 |
44
- | D8 UI 反馈 | toastmodalloading 指示 |
45
- | D9 组件联动 | 筛选、tab、数量、级联变化 |
46
- | D10 边界情况 | 空数据、长文本、特殊输入、前置数据缺失 |
47
-
48
- ## 隐性场景默认挖掘
49
-
50
- OpenTest plan 阶段默认检查以下问题;适用则进入矩阵,不适用则简短说明:
51
-
52
- | 类别 | 默认追问 |
37
+ | D1 Page rendering | Title, copy, structure, primary elements exist |
38
+ | D2 Interaction behavior | Click, input, selection, dialog, menu |
39
+ | D3 Data display | API data, formatting, status display |
40
+ | D4 Form validation | Required fields, format, boundary, dependent validation |
41
+ | D5 Navigation flow | Menu, link, back path, cross-page parameter passing |
42
+ | D6 State management | loading, empty, error, retry |
43
+ | D7 Permission control | Roles, route guards, unauthorized access blocking |
44
+ | D8 UI feedback | toast, modal, loading indicator |
45
+ | D9 Component coordination | Filters, tabs, counts, cascading changes |
46
+ | D10 Boundary cases | Empty data, long text, special input, missing prerequisite data |
47
+
48
+ ## Default Implicit Scenario Mining
49
+
50
+ The OpenTest plan phase checks these questions by default. If applicable, add them to the matrix; if not applicable, explain briefly:
51
+
52
+ | Category | Default question |
53
53
  | --- | --- |
54
- | 输入为空 | 空字段是否阻止提交,错误显示在字段下方还是表单顶部 |
55
- | 输入非法 | 格式、长度、范围、重复值、依赖字段如何反馈 |
56
- | 网络失败 | 是否显示网络错误、重试入口,是否保留用户输入 |
57
- | 服务端失败 | 4xx/5xx 是否区分,是否避免泄露技术细节 |
58
- | 认证/会话 | token 过期、未登录、已登录访问登录页如何处理 |
59
- | 权限不足 | 操作隐藏、禁用还是显示权限说明 |
60
- | 重复提交 | 提交中按钮状态、防重复请求、幂等或冲突处理 |
61
- | 空数据 | 初始无数据和筛选无结果是否区分 |
62
- | 长内容/大数据 | 分页、截断、虚拟化、长文本和极端数量 |
63
- | 移动端 | 键盘遮挡、触控目标、窄屏布局和返回路径 |
64
- | 可访问性 | 键盘路径、焦点、错误关联、屏幕阅读器提示 |
65
- | 安全 | 敏感信息、越权、注入、CSRF/重复操作风险 |
66
-
67
- ## 输出约束
68
-
69
- `/opentest-plan` 应优先输出窄矩阵:
54
+ | Empty input | Does an empty field block submit, and does the error appear below the field or at form level? |
55
+ | Invalid input | How are format, length, range, duplicate values, and dependent fields reported? |
56
+ | Network failure | Is a network error and retry entry shown, and is user input preserved? |
57
+ | Server failure | Are 4xx/5xx failures distinguished, and are technical details avoided? |
58
+ | Auth/session | How are expired tokens, unauthenticated access, and signed-in visits to login handled? |
59
+ | Missing permissions | Is the action hidden, disabled, or explained with permission copy? |
60
+ | Duplicate submit | Does the submitting button state prevent duplicate requests, and is idempotency or conflict handled? |
61
+ | Empty data | Are initial empty state and filtered no-result state distinguished? |
62
+ | Long content/large data | Are pagination, truncation, virtualization, long text, and extreme counts handled? |
63
+ | Mobile | Are keyboard overlap, touch targets, narrow layout, and return paths handled? |
64
+ | Accessibility | Are keyboard path, focus, error association, and screen reader hints handled? |
65
+ | Security | Are sensitive information, authorization bypass, injection, CSRF, and duplicate action risks considered? |
66
+
67
+ ## Output Constraints
68
+
69
+ `/opentest-plan` should prefer a narrow matrix:
70
70
 
71
71
  ```markdown
72
- | ID | 意图 | 风险 | 必需证据 | 状态 |
72
+ | ID | Intent | Risk | Required evidence | Status |
73
73
  | --- | --- | --- | --- | --- |
74
- | ACC-001 | 用户保存后看到成功反馈 | medium | UI 验收 | pending |
74
+ | ACC-001 | User sees success feedback after save | medium | UI acceptance | pending |
75
75
  ```
76
76
 
77
- 只有当风险或变更类型需要时,才增加覆盖维度、命令、证据路径和阻塞原因列。
77
+ Add coverage dimension, command, evidence path, and blocker reason columns only when risk or change type requires them.
78
78
 
79
- ## 质量门启发
79
+ ## Quality Gate Heuristics
80
80
 
81
- 验证建议按 buildtypelinttestsecuritydiff 的顺序组织。构建、类型、lint、必需测试或必需验收失败时应阻塞通过;非必需证据缺口可以作为可解释风险记录。
81
+ Verification is recommended in build, type, lint, test, security, diff order. Build, type, lint, required test, or required acceptance failures should block pass. Non-required evidence gaps may be recorded as explainable risk.
82
82
 
83
- 工具、环境、前置数据或 MCP 不可用时,记录 `blocked` evidence,不得声称验收通过。
83
+ When tooling, environment, prerequisite data, or MCP is unavailable, record `blocked` evidence and do not claim acceptance passed.
@@ -4,7 +4,7 @@
4
4
 
5
5
  `plan -> author -> run -> accept -> verify -> archive`
6
6
 
7
- `heal` 是失败恢复阶段,只在测试资产过期或验收执行路径失效时进入。
7
+ `heal` is the failure recovery phase and should only be entered when test assets are stale or the acceptance execution path has broken.
8
8
 
9
9
  ## Exit Conditions
10
10
 
@@ -2,26 +2,26 @@
2
2
 
3
3
  ## Minimal Columns
4
4
 
5
- | ID | 意图 | 触发/输入 | 期望行为 | 风险 | 证据层级 | 必需证据 | 状态 |
5
+ | ID | Intent | Trigger/Input | Expected behavior | Risk | Evidence layer | Required evidence | Status |
6
6
  | --- | --- | --- | --- | --- | --- | --- | --- |
7
7
 
8
8
  ## Optional Columns
9
9
 
10
- - 覆盖面
11
- - 命令
12
- - 证据路径
13
- - 阻塞原因
14
- - 风险接受说明
10
+ - Coverage
11
+ - Command
12
+ - Evidence path
13
+ - Blocker reason
14
+ - Risk acceptance note
15
15
 
16
16
  Only add optional columns when risk or change type needs them.
17
17
 
18
18
  ## Evidence Layers
19
19
 
20
- - `unit`:纯函数、校验规则、状态计算。
21
- - `component`:表单反馈、按钮状态、局部 UI 状态。
22
- - `integration`:模块协作、API client、状态管理、mock server
23
- - `contract`:请求/响应字段、错误码、权限响应。
24
- - `e2e`:跨页面、登录、权限、关键业务闭环。
25
- - `smoke`:关键页面或主路径不崩。
26
- - `browser-acceptance`:真实浏览器交互、反馈位置、响应式和视觉状态。
27
- - `security-review`:权限、敏感信息、越权、重复提交、注入风险。
20
+ - `unit`: pure functions, validation rules, state calculation.
21
+ - `component`: form feedback, button states, local UI states.
22
+ - `integration`: module collaboration, API client, state management, mock server.
23
+ - `contract`: request/response fields, error codes, permission responses.
24
+ - `e2e`: cross-page flows, login, permissions, critical business loops.
25
+ - `smoke`: key pages or happy paths do not crash.
26
+ - `browser-acceptance`: real browser interaction, feedback location, responsive and visual state.
27
+ - `security-review`: permissions, sensitive information, authorization bypass, duplicate submit, injection risk.
@@ -1,48 +1,48 @@
1
1
  # OpenTest-Driven Development
2
2
 
3
- ## 定位
3
+ ## Positioning
4
4
 
5
- OpenTest-driven development 不是传统 TDD 的替代名词。它把 TDD 放进更大的质量证据链里:先做隐性场景挖掘和风险矩阵,再决定哪些用 unit/component/integration/contract/E2E/smoke/browser acceptance/security review 证明。
5
+ OpenTest-driven development is not a replacement name for traditional TDD. It places TDD inside a broader quality evidence chain: first mine implicit scenarios and build a risk matrix, then decide which behavior is proven by unit, component, integration, contract, E2E, smoke, browser acceptance, or security review evidence.
6
6
 
7
- ## 为什么不是只写 TDD
7
+ ## Why Not Just TDD
8
8
 
9
- 传统 TDD 容易只覆盖显性需求和 happy path。真实产品行为还包括:
9
+ Traditional TDD can easily cover only explicit requirements and happy paths. Real product behavior also includes:
10
10
 
11
- - 空输入、非法输入和字段依赖。
12
- - 网络失败、服务端失败、认证过期和权限不足。
13
- - 错误反馈到底显示在字段下方、表单顶部、toastmodal 还是页面错误区。
11
+ - Empty input, invalid input, and field dependencies.
12
+ - Network failures, server failures, expired auth, and missing permissions.
13
+ - Whether error feedback appears below a field, at the top of a form, in a toast, in a modal, or in a page error region.
14
14
  - loading、empty、retry、disabled、submitting、long content、mobile。
15
- - 跨页面跳转、返回恢复、数据刷新和重复提交。
15
+ - Cross-page navigation, return restoration, data refresh, and duplicate submission.
16
16
 
17
- 这些场景需要先进入 acceptance-to-test matrix,再决定证据层级。
17
+ These scenarios should enter the acceptance-to-test matrix before evidence layers are selected.
18
18
 
19
- ## 推荐顺序
19
+ ## Recommended Order
20
20
 
21
21
  ```text
22
- 需求 / OpenSuper design
23
- -> OpenTest plan: 隐性场景 + 风险 + 证据层级
24
- -> OpenTest author: 测试资产和自然语言验收
25
- -> build: 按矩阵实现
26
- -> OpenTest run: 跑项目命令
27
- -> OpenTest accept: 真实验收
28
- -> OpenTest verify: 质量门报告
22
+ Requirement / OpenSuper design
23
+ -> OpenTest plan: implicit scenarios + risk + evidence layers
24
+ -> OpenTest author: test assets and natural language acceptance
25
+ -> build: implement against the matrix
26
+ -> OpenTest run: run project commands
27
+ -> OpenTest accept: real acceptance
28
+ -> OpenTest verify: quality gate report
29
29
  -> OpenSuper verify/archive
30
30
  ```
31
31
 
32
- ## 登录示例
32
+ ## Login Example
33
33
 
34
- | ID | 意图 | 触发/输入 | 期望行为 | 风险 | 证据层级 | 必需证据 | 状态 |
34
+ | ID | Intent | Trigger/Input | Expected behavior | Risk | Evidence layer | Required evidence | Status |
35
35
  | --- | --- | --- | --- | --- | --- | --- | --- |
36
- | ACC-001 | 正确账号登录成功 | 合法账号密码 | 跳转目标页并建立会话 | high | e2e | 登录流程验收 | pending |
37
- | ACC-002 | 用户名为空 | 空用户名 + 任意密码 | 用户名字段下方错误,不发请求 | medium | component | 表单测试或 UI 验收 | pending |
38
- | ACC-003 | 密码错误 | 正确用户名 + 错误密码 | 表单顶部或密码区域显示认证失败,保留用户名 | high | integration | API mock + UI 验收 | pending |
39
- | ACC-004 | 网络断开 | 登录请求网络失败 | 显示网络错误和重试,不误报密码错误 | high | e2e | 网络失败验收 | pending |
40
- | ACC-005 | 重复点击提交 | 请求中再次点击 | 按钮 loading 且不重复提交 | medium | component | UI 状态测试 | pending |
41
- | ACC-006 | token 过期 | 访问受保护页面 | 回登录页并保留来源路径 | high | e2e | 会话过期验收 | pending |
42
-
43
- ## 输出要求
44
-
45
- - 每个 required 场景必须有证据层级和执行面。
46
- - blocked 不能直接等于 pass;必须写原因和恢复路径。
47
- - high-risk 场景缺证据默认 fail,除非用户明确接受风险并写明理由。
48
- - 产品行为失败不能通过 heal 掩盖,必须回到实现或需求修正。
36
+ | ACC-001 | Valid account logs in successfully | Valid username and password | Redirect to target page and establish session | high | e2e | Login flow acceptance | pending |
37
+ | ACC-002 | Username is empty | Empty username plus any password | Show username field error and do not send request | medium | component | Form test or UI acceptance | pending |
38
+ | ACC-003 | Password is wrong | Valid username plus wrong password | Show auth failure at form level or near password, preserving username | high | integration | API mock plus UI acceptance | pending |
39
+ | ACC-004 | Network is disconnected | Login request network failure | Show network error and retry, without misreporting password failure | high | e2e | Network failure acceptance | pending |
40
+ | ACC-005 | Submit clicked repeatedly | Click submit again while request is in flight | Button shows loading and duplicate submit is prevented | medium | component | UI state test | pending |
41
+ | ACC-006 | Token expires | Visit protected page | Return to login and preserve source path | high | e2e | Session expiry acceptance | pending |
42
+
43
+ ## Output Requirements
44
+
45
+ - Every required scenario must have an evidence layer and execution surface.
46
+ - blocked is not pass; it must include a reason and recovery path.
47
+ - Missing evidence for high-risk scenarios defaults to fail unless the user explicitly accepts the risk and the reason is written down.
48
+ - Product behavior failure must not be hidden by heal; return to implementation or requirement correction.
@@ -1,4 +1,4 @@
1
- # OpenTest 验收用例
1
+ # OpenTest Acceptance Case
2
2
 
3
3
  ## ACC-001
4
4