@pzy560117/opentest 0.1.7 → 0.1.9
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.
- package/assets/manifest.json +2 -1
- package/assets/skills/opentest/SKILL.md +15 -75
- package/assets/skills/opentest/references/acceptance-evidence.md +14 -0
- package/assets/skills/opentest/references/complete-testing-workflow.md +66 -0
- package/assets/skills/opentest-accept/SKILL.md +12 -14
- package/assets/skills/opentest-author/SKILL.md +13 -19
- package/assets/skills/opentest-plan/SKILL.md +14 -23
- package/assets/skills/opentest-run/SKILL.md +17 -20
- package/assets/skills/opentest-verify/SKILL.md +13 -18
- package/assets/skills-zh/opentest/SKILL.md +15 -75
- package/assets/skills-zh/opentest/references/acceptance-evidence.md +14 -0
- package/assets/skills-zh/opentest/references/complete-testing-workflow.md +66 -0
- package/assets/skills-zh/opentest-accept/SKILL.md +12 -14
- package/assets/skills-zh/opentest-author/SKILL.md +13 -19
- package/assets/skills-zh/opentest-plan/SKILL.md +13 -22
- package/assets/skills-zh/opentest-run/SKILL.md +17 -20
- package/assets/skills-zh/opentest-verify/SKILL.md +13 -18
- package/package.json +1 -1
- package/scripts/smoke-test.js +30 -0
package/assets/manifest.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.1.
|
|
2
|
+
"version": "0.1.9",
|
|
3
3
|
"languages": [
|
|
4
4
|
{
|
|
5
5
|
"id": "en",
|
|
@@ -62,6 +62,7 @@
|
|
|
62
62
|
"opentest/references/acceptance-evidence.md",
|
|
63
63
|
"opentest/references/codex-harness-coverage-heuristics.md",
|
|
64
64
|
"opentest/references/command-routing.md",
|
|
65
|
+
"opentest/references/complete-testing-workflow.md",
|
|
65
66
|
"opentest/references/lifecycle.md",
|
|
66
67
|
"opentest/references/matrix-format.md",
|
|
67
68
|
"opentest/references/opentest-driven-development.md",
|
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: opentest
|
|
3
|
-
description: "OpenTest router
|
|
3
|
+
description: "OpenTest router entry: detect .opentest.yaml, initialize lifecycle state, and route to plan/author/run/accept/verify/heal/archive."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# OpenTest
|
|
6
|
+
# OpenTest
|
|
7
7
|
|
|
8
|
-
OpenTest
|
|
8
|
+
OpenTest turns change requirements into a test-evidence lifecycle before implementation work proceeds.
|
|
9
9
|
|
|
10
|
-
##
|
|
10
|
+
## Required references
|
|
11
11
|
|
|
12
|
-
-
|
|
13
|
-
-
|
|
12
|
+
- `opentest/references/command-routing.md`
|
|
13
|
+
- `opentest/references/lifecycle.md`
|
|
14
|
+
- `opentest/references/complete-testing-workflow.md`
|
|
14
15
|
|
|
15
|
-
##
|
|
16
|
-
|
|
17
|
-
Run:
|
|
16
|
+
## Bootstrap
|
|
18
17
|
|
|
19
18
|
```bash
|
|
20
19
|
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")
|
|
@@ -23,71 +22,12 @@ OPENTEST_GUARD="${OPENTEST_GUARD:-$(find "${OPENTEST_SEARCH_ROOTS[@]}" -path '*/
|
|
|
23
22
|
OPENTEST_DETECT="${OPENTEST_DETECT:-$(find "${OPENTEST_SEARCH_ROOTS[@]}" -path '*/opentest/scripts/opentest-detect.sh' -type f -print -quit 2>/dev/null)}"
|
|
24
23
|
```
|
|
25
24
|
|
|
26
|
-
If any script is missing, stop and ask the user to install
|
|
27
|
-
|
|
28
|
-
## Step 1: Detect State
|
|
29
|
-
|
|
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
|
-
|
|
32
|
-
If `.opentest.yaml` does not exist, run:
|
|
33
|
-
|
|
34
|
-
```bash
|
|
35
|
-
bash "$OPENTEST_STATE" init
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
Then run:
|
|
39
|
-
|
|
40
|
-
```bash
|
|
41
|
-
bash "$OPENTEST_STATE" check
|
|
42
|
-
bash "$OPENTEST_DETECT" summary
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
## Step 2: Dispatch Phase
|
|
46
|
-
|
|
47
|
-
Read `phase`:
|
|
48
|
-
|
|
49
|
-
```bash
|
|
50
|
-
bash "$OPENTEST_STATE" get phase
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
Dispatch rules:
|
|
54
|
-
|
|
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
|
-
|
|
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
|
-
|
|
66
|
-
## OpenTest-Driven Development Usage
|
|
67
|
-
|
|
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
|
-
|
|
70
|
-
```text
|
|
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
|
-
```
|
|
79
|
-
|
|
80
|
-
The `plan` phase must not merely restate requirements. It must actively inspect:
|
|
81
|
-
|
|
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
|
-
|
|
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
|
-
|
|
89
|
-
## Loop Handoff Integration
|
|
25
|
+
If any script is missing, stop and ask the user to install OpenTest.
|
|
90
26
|
|
|
91
|
-
|
|
27
|
+
## Route
|
|
92
28
|
|
|
93
|
-
|
|
29
|
+
1. If `.opentest.yaml` is missing, run `bash "$OPENTEST_STATE" init`.
|
|
30
|
+
2. Run `bash "$OPENTEST_STATE" check` and `bash "$OPENTEST_DETECT" summary`.
|
|
31
|
+
3. Read `phase` with `bash "$OPENTEST_STATE" get phase`.
|
|
32
|
+
4. Dispatch to `opentest-plan`, `opentest-author`, `opentest-run`, `opentest-accept`, `opentest-verify`, `opentest-heal`, or `opentest-archive`.
|
|
33
|
+
5. Keep generated user-facing artifacts in the installed skill language.
|
|
@@ -25,3 +25,17 @@ Allowed evidence status:
|
|
|
25
25
|
Blocked evidence must include a reason such as unavailable MCP, unavailable environment, missing seed data, auth requirement, or external service failure.
|
|
26
26
|
|
|
27
27
|
UI feedback evidence should record the actual location and shape of feedback, for example field-level inline error, form-level alert, toast, modal, page-level error panel, disabled control, loading indicator, or retry action.
|
|
28
|
+
|
|
29
|
+
## Case Granularity Rules
|
|
30
|
+
|
|
31
|
+
Acceptance matrices must distinguish render validation, functional validation, and side-effect validation. Do not treat "the screen can open" as complete acceptance.
|
|
32
|
+
|
|
33
|
+
- Render validation: confirm that the entry point, dialog, form, list, or key control renders in the real page.
|
|
34
|
+
- Functional validation: confirm that the business result actually takes effect after the user completes the key action.
|
|
35
|
+
- Side-effect validation: confirm that dialogs, overlays, loading states, disabled states, toasts, or error states do not remain and mislead the next action.
|
|
36
|
+
|
|
37
|
+
Any case with form submission, create, edit, delete, upload, authorization, state transition, or another write operation must include the full "fill/input -> submit/confirm -> verify result took effect" chain. Examples:
|
|
38
|
+
|
|
39
|
+
- Address form can open (render validation).
|
|
40
|
+
- User can fill and submit the form, and the new address appears in the list or detail view (functional validation).
|
|
41
|
+
- After submission, the dialog closes, no overlay or stale loading state remains, and the next action is still usable (side-effect validation).
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# Complete Testing Workflow
|
|
2
|
+
|
|
3
|
+
Use this reference only when the phase skill asks for detailed coverage rules.
|
|
4
|
+
|
|
5
|
+
## Default Evidence Chain
|
|
6
|
+
|
|
7
|
+
```text
|
|
8
|
+
plan -> matrix -> fixtures -> tests -> run -> accept -> smoke -> pre-push -> verify -> archive
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Test Data
|
|
12
|
+
|
|
13
|
+
Create `docs/opentest/fixtures/` for changes that touch data, files, roles, permissions, APIs, or stateful workflows.
|
|
14
|
+
|
|
15
|
+
Required sections:
|
|
16
|
+
|
|
17
|
+
- users and roles
|
|
18
|
+
- permissions
|
|
19
|
+
- entities for valid, existing, invalid, duplicate, unauthorized, and stale states
|
|
20
|
+
- files/images when uploads, previews, or media validation exist
|
|
21
|
+
- seed command and idempotency rule
|
|
22
|
+
- teardown command and cleanup scope
|
|
23
|
+
- assertions for UI, API, DB/storage, files, and logs
|
|
24
|
+
|
|
25
|
+
## CRUD Baseline
|
|
26
|
+
|
|
27
|
+
For persisted data, APIs, forms, files, or stateful flows, include these matrix dimensions:
|
|
28
|
+
|
|
29
|
+
- create: validation, success, visibility in list/detail
|
|
30
|
+
- read/list/detail: list, search, filter, pagination, empty state, detail
|
|
31
|
+
- update: initial values, validation failure, save, read back
|
|
32
|
+
- delete: confirmation, cancel, success, post-delete absence
|
|
33
|
+
- failure/boundary: invalid, empty, duplicate, unauthorized, stale, network/API error
|
|
34
|
+
- data consistency: UI, API, DB/storage, files, logs
|
|
35
|
+
- end-to-end CRUD: create -> list -> detail -> update -> read back -> delete -> confirm absence -> teardown
|
|
36
|
+
|
|
37
|
+
If a leg is not applicable, record why in `gap/blocker`.
|
|
38
|
+
|
|
39
|
+
## Interaction Acceptance Hard Rules
|
|
40
|
+
|
|
41
|
+
When Playwright CLI, browser MCP, or manual real-page acceptance executes CRUD, form submission, file upload, authorization, state transition, or another write operation, it must include post-submit assertions. Screenshots or "the page did not crash" are not enough.
|
|
42
|
+
|
|
43
|
+
Recommended execution chain:
|
|
44
|
+
|
|
45
|
+
```text
|
|
46
|
+
open -> snapshot -> fill/input -> click(submit/confirm) -> snapshot -> read/assert changed result -> screenshot -> PASS/FAIL
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
- Read-after-write validation: after submission, re-read at least one trustworthy result surface such as the page, list, detail view, API response, storage record, or logs, and confirm the value changed.
|
|
50
|
+
- Dialog/overlay validation: after a successful write, assert that the dialog closes, overlay is removed, loading stops, button state recovers, and the next action is usable.
|
|
51
|
+
- Failure-path validation: for validation failure, permission failure, or network/API errors, assert the feedback location, input retention strategy, and recovery path.
|
|
52
|
+
- Evidence recording: PASS must state the changed result that was asserted. If no result surface can be read, mark the evidence as `blocked` or `risk-accepted` and record why.
|
|
53
|
+
|
|
54
|
+
## Run Gates
|
|
55
|
+
|
|
56
|
+
- targeted: evidence linked to changed matrix rows
|
|
57
|
+
- fast: type, lint, unit
|
|
58
|
+
- full: project full test set
|
|
59
|
+
- ci-like: CI order
|
|
60
|
+
- pre-push: format/check, lint, type, unit, targeted integration, smoke, `git diff --check`
|
|
61
|
+
|
|
62
|
+
Default code test command is `python -m pytest`. Coverage command is `python -m pytest --cov=. --cov-report=term-missing`.
|
|
63
|
+
|
|
64
|
+
## Verify Gates
|
|
65
|
+
|
|
66
|
+
Block pass when required fixtures, seed/teardown, smoke, pre-push, coverage, CRUD, or full-chain acceptance evidence is missing for an applicable high-risk change.
|
|
@@ -5,21 +5,19 @@ description: "OpenTest phase 4: execute natural language, MCP, or real workflow
|
|
|
5
5
|
|
|
6
6
|
# OpenTest Accept
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Execute required acceptance items and write PASS, FAIL, or blocked evidence back to cases and the matrix.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
## Required references
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
2. For frontend interactions, prefer Chrome DevTools MCP to execute real page acceptance.
|
|
16
|
-
3. For APIs or backend workflows, use existing project commands or direct API checks.
|
|
17
|
-
4. For feedback scenarios, observe the actual rendered location and shape. For example, field errors must not be recorded only as "failed"; record whether they appear below the field, at the top of the form, in a toast, in a modal, or in a page error region.
|
|
18
|
-
5. When tools, environment, or seed data are unavailable, record blocked evidence.
|
|
19
|
-
6. Update acceptance records.
|
|
20
|
-
7. If the project uses Loop Handoff, update `docs/loop-handoff/latest.md` with acceptance result, screenshot/step evidence paths, blocked evidence, and next step.
|
|
21
|
-
8. Run `bash "$OPENTEST_GUARD" accept --apply`.
|
|
12
|
+
- `opentest/references/acceptance-evidence.md`
|
|
13
|
+
- `opentest/references/complete-testing-workflow.md`
|
|
14
|
+
- `opentest/templates/acceptance-template.md`
|
|
22
15
|
|
|
23
|
-
##
|
|
16
|
+
## Steps
|
|
24
17
|
|
|
25
|
-
|
|
18
|
+
1. Read the matrix, fixtures, and `docs/opentest/acceptance/`.
|
|
19
|
+
2. For frontend interactions, prefer Chrome DevTools MCP and observe the real rendered UI.
|
|
20
|
+
3. For API/backend workflows, use project commands or direct API checks.
|
|
21
|
+
4. For CRUD/data changes, execute the full chain from the workflow reference.
|
|
22
|
+
5. Record feedback location/shape, artifacts, blocked evidence, and matching ACC IDs.
|
|
23
|
+
6. Update acceptance records and run `bash "$OPENTEST_GUARD" accept --apply`.
|
|
@@ -1,30 +1,24 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: opentest-author
|
|
3
|
-
description: "OpenTest phase 2: create test assets and natural language acceptance cases from the matrix."
|
|
3
|
+
description: "OpenTest phase 2: create test assets, fixtures, and natural language acceptance cases from the matrix."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# OpenTest Author
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Turn the matrix into executable tests, fixtures, seed/teardown notes, and acceptance cases.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
## Required references
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
- `opentest/references/opentest-driven-development.md`
|
|
13
|
+
- `opentest/references/complete-testing-workflow.md`
|
|
14
|
+
- `opentest/templates/fixtures-template.md`
|
|
15
|
+
- `opentest/templates/acceptance-template.md`
|
|
13
16
|
|
|
14
17
|
## Steps
|
|
15
18
|
|
|
16
|
-
1. Read `matrix` from `.opentest.yaml`.
|
|
17
|
-
2. For
|
|
18
|
-
3.
|
|
19
|
-
4.
|
|
20
|
-
5.
|
|
21
|
-
6.
|
|
22
|
-
7. For frontend feedback cases, specify the feedback location and shape, such as field-level errors, form-level errors, toast, modal, inline status, or page error state.
|
|
23
|
-
8. Record reasons and risk for evidence that is not applicable or cannot currently be created.
|
|
24
|
-
9. Write the `.opentest.yaml` `fixtures` and `acceptance` fields.
|
|
25
|
-
10. If the project uses Loop Handoff, update `docs/loop-handoff/latest.md` with fixtures, seed/teardown, test assets, natural language acceptance cases, gaps/risks, and next step.
|
|
26
|
-
11. Run `bash "$OPENTEST_GUARD" author --apply`.
|
|
27
|
-
|
|
28
|
-
## Existing Skill Routing
|
|
29
|
-
|
|
30
|
-
When the matrix requires code-level test evidence, load the existing TDD guidance first. If project rules require a specific test framework, follow those rules. If no project framework is present, use pytest as the default instead of inventing a custom harness. If the current task is better proven by real acceptance than by adding test framework code, record the reason and hand it to `opentest-accept`.
|
|
19
|
+
1. Read `matrix` and `fixtures` from `.opentest.yaml`.
|
|
20
|
+
2. For code evidence, use the project framework; if none exists, Default to pytest with tests under `tests/` runnable by `python -m pytest`.
|
|
21
|
+
3. Create/update fixtures, seed, teardown, users, roles, entities, files/images, and assertion surfaces.
|
|
22
|
+
4. For CRUD/data changes, author the full acceptance flow: create -> list -> detail -> update -> read back -> delete -> confirm absence -> teardown.
|
|
23
|
+
5. Record any gap/blocker with reason and risk.
|
|
24
|
+
6. Write `.opentest.yaml` fields: `fixtures`, `acceptance`, then run `bash "$OPENTEST_GUARD" author --apply`.
|
|
@@ -1,36 +1,27 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: opentest-plan
|
|
3
|
-
description: "OpenTest phase 1: analyze the change, risks,
|
|
3
|
+
description: "OpenTest phase 1: analyze the change, risks, project facts, and create a test strategy plus acceptance-to-test matrix."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# OpenTest Plan
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Create `docs/opentest/plans/`, `docs/opentest/matrices/`, and a fixtures plan before implementation.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
## Required references
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
- `opentest/references/codex-harness-coverage-heuristics.md`
|
|
13
|
+
- `opentest/references/matrix-format.md`
|
|
14
|
+
- `opentest/references/complete-testing-workflow.md`
|
|
13
15
|
|
|
14
16
|
## Steps
|
|
15
17
|
|
|
16
|
-
1. Read project rules, requirements
|
|
17
|
-
2.
|
|
18
|
-
3.
|
|
19
|
-
4.
|
|
20
|
-
5.
|
|
21
|
-
6.
|
|
22
|
-
7. Produce a narrow matrix with at least `ID`, `intent`, `coverage dimension`, `trigger/input`, `expected behavior`, `risk`, `evidence layer`, `framework/command`, `required evidence`, `gap/blocker`, and `status`.
|
|
23
|
-
8. Mark applicable but uncovered evidence as `gap`, and record a concrete blocker or recovery path instead of leaving coverage unknown.
|
|
24
|
-
9. Write the `.opentest.yaml` `plan`, `matrix`, and `fixtures` fields.
|
|
25
|
-
10. If the project uses Loop Handoff, update `docs/loop-handoff/latest.md` with the plan path, matrix path, fixtures path, current phase, and next step.
|
|
26
|
-
11. Run `bash "$OPENTEST_GUARD" plan --apply`.
|
|
18
|
+
1. Read project rules, requirements/design/diff, existing commands, and detection output.
|
|
19
|
+
2. Classify risk, applicable coverage, test data, and whether code tests use an existing framework or default `pytest`.
|
|
20
|
+
3. Apply the CRUD baseline and test data requirements from the workflow reference for data-writing/API/form/file/stateful changes.
|
|
21
|
+
4. Produce a matrix with coverage dimension, framework/command, required evidence, gap/blocker, and status.
|
|
22
|
+
5. Write `.opentest.yaml` fields: `plan`, `matrix`, `fixtures`.
|
|
23
|
+
6. Update handoff if present, then run `bash "$OPENTEST_GUARD" plan --apply`.
|
|
27
24
|
|
|
28
|
-
##
|
|
25
|
+
## Gate
|
|
29
26
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
Do not force all evidence into unit tests. The matrix must state which behavior is proven by unit, component, integration, contract, E2E, smoke, browser acceptance, or security review evidence.
|
|
33
|
-
|
|
34
|
-
Coverage completeness means every applicable product behavior, failure path, boundary, and risk surface has either required evidence or an explicit gap/blocker. It does not mean every task must run every possible test type.
|
|
35
|
-
|
|
36
|
-
CRUD baseline and test data are default requirements for data-writing changes. If any CRUD leg is not applicable, the matrix must state why.
|
|
27
|
+
Every applicable behavior, failure path, boundary, and risk surface needs evidence or a written gap/blocker. CRUD baseline and test data are default requirements unless the matrix says why they are not applicable.
|
|
@@ -1,34 +1,31 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: opentest-run
|
|
3
|
-
description: "OpenTest phase 3: run project
|
|
3
|
+
description: "OpenTest phase 3: run project verification commands in targeted, fast, full, ci-like, or pre-push mode."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# OpenTest Run
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Run matrix-driven commands and write evidence reports under `docs/opentest/runs/`.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
## Required references
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
- `targeted`: run only test commands related to the matrix.
|
|
15
|
-
- `fast`: run fast feedback commands, such as type, lint, and unit.
|
|
16
|
-
- `full`: run the project's full test command set.
|
|
17
|
-
- `ci-like`: reproduce CI verification order as closely as practical.
|
|
18
|
-
- `pre-push`: run the push gate sequence before publishing or pushing.
|
|
12
|
+
- `opentest/references/command-routing.md`
|
|
13
|
+
- `opentest/references/complete-testing-workflow.md`
|
|
19
14
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
If `.opentest.yaml` has `test_framework: pytest`, or code-level test evidence is required and no project framework is declared, use `python -m pytest` as the default test command. When the matrix requires coverage evidence, prefer `python -m pytest --cov=. --cov-report=term-missing` and write the coverage output path to `.opentest.yaml` `coverage_report`. If pytest or pytest-cov is unavailable, record `missing command` with the install/remediation step instead of passing the gate.
|
|
15
|
+
## Modes
|
|
23
16
|
|
|
24
|
-
|
|
17
|
+
- `targeted`: matrix-related commands only.
|
|
18
|
+
- `fast`: type/lint/unit feedback.
|
|
19
|
+
- `full`: full project command set.
|
|
20
|
+
- `ci-like`: reproduce CI order.
|
|
21
|
+
- `pre-push`: push gate sequence.
|
|
25
22
|
|
|
26
23
|
## Steps
|
|
27
24
|
|
|
28
|
-
1. Read `run_mode
|
|
29
|
-
2. Prefer explicit project commands
|
|
30
|
-
3.
|
|
31
|
-
4.
|
|
32
|
-
5.
|
|
33
|
-
6.
|
|
25
|
+
1. Read `run_mode`, matrix, fixtures, and required evidence.
|
|
26
|
+
2. Prefer explicit project commands; otherwise use `python -m pytest` for code-level tests.
|
|
27
|
+
3. For coverage, prefer `python -m pytest --cov=. --cov-report=term-missing`.
|
|
28
|
+
4. Smoke evidence is required unless the matrix says not applicable.
|
|
29
|
+
5. For `pre-push`, run or record format/check, lint, type, unit, targeted integration, smoke, and `git diff --check`.
|
|
30
|
+
6. Write `run_report`, plus `coverage_report`, `smoke_report`, or `pre_push_report` when produced/required.
|
|
34
31
|
7. Run `bash "$OPENTEST_GUARD" run --apply`.
|
|
@@ -5,25 +5,20 @@ description: "OpenTest phase 5: apply quality gates and generate a verification
|
|
|
5
5
|
|
|
6
6
|
# OpenTest Verify
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Apply quality gates and write `verification_report` plus `verification_result`.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
## Required references
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
- `opentest/references/quality-gate.md`
|
|
13
|
+
- `opentest/references/complete-testing-workflow.md`
|
|
14
|
+
- `opentest/templates/report-template.md`
|
|
13
15
|
|
|
14
|
-
|
|
16
|
+
## Steps
|
|
15
17
|
|
|
16
|
-
Organize evidence in build, type, lint, test, security, diff order.
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
-
|
|
23
|
-
- Test data is traceable: fixture, seed, teardown, and cleanup evidence exist for data-writing or CRUD changes.
|
|
24
|
-
- Smoke evidence is required unless the matrix explicitly marks smoke as not applicable.
|
|
25
|
-
- pre-push evidence is required before push/publish unless the user explicitly skips it and the report records the risk.
|
|
26
|
-
- High-risk behavior does not pass merely because tooling, a test framework, or seed data is missing.
|
|
27
|
-
- If code-level coverage was required and `test_framework: pytest` is active, the report must include the `python -m pytest` command result and the `coverage_report` path, or fail/block with a reason.
|
|
28
|
-
- Blocked evidence includes a blocker reason and recovery path.
|
|
29
|
-
- If product behavior fails, do not enter `heal` to patch test assets; return to implementation or requirement correction.
|
|
18
|
+
1. Organize evidence in build, type, lint, test, security, diff order.
|
|
19
|
+
2. Check every required evidence item has pass, fail, blocked, or risk-accepted.
|
|
20
|
+
3. Confirm Coverage completeness: every applicable coverage dimension has evidence or a gap/blocker with recovery path.
|
|
21
|
+
4. Smoke evidence is required unless the matrix marks smoke not applicable.
|
|
22
|
+
5. pre-push evidence is required before push/publish unless the user explicitly skips it and risk is recorded.
|
|
23
|
+
6. For CRUD/data changes, fixture, seed, teardown, cleanup, and `coverage_report` evidence are required when applicable.
|
|
24
|
+
7. High-risk behavior must not pass because tooling, fixture, seed data, or framework is missing.
|
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: opentest
|
|
3
|
-
description: "OpenTest 路由入口。自动检测 .opentest.yaml
|
|
3
|
+
description: "OpenTest 路由入口。自动检测 .opentest.yaml、初始化生命周期状态,并分发到 plan/author/run/accept/verify/heal/archive。"
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# OpenTest
|
|
6
|
+
# OpenTest
|
|
7
7
|
|
|
8
|
-
OpenTest
|
|
8
|
+
OpenTest 在实现前把需求转成测试证据生命周期。
|
|
9
9
|
|
|
10
|
-
##
|
|
10
|
+
## 必读引用
|
|
11
11
|
|
|
12
|
-
-
|
|
13
|
-
-
|
|
12
|
+
- `opentest/references/command-routing.md`
|
|
13
|
+
- `opentest/references/lifecycle.md`
|
|
14
|
+
- `opentest/references/complete-testing-workflow.md`
|
|
14
15
|
|
|
15
|
-
##
|
|
16
|
-
|
|
17
|
-
运行:
|
|
16
|
+
## 启动
|
|
18
17
|
|
|
19
18
|
```bash
|
|
20
19
|
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")
|
|
@@ -23,71 +22,12 @@ OPENTEST_GUARD="${OPENTEST_GUARD:-$(find "${OPENTEST_SEARCH_ROOTS[@]}" -path '*/
|
|
|
23
22
|
OPENTEST_DETECT="${OPENTEST_DETECT:-$(find "${OPENTEST_SEARCH_ROOTS[@]}" -path '*/opentest/scripts/opentest-detect.sh' -type f -print -quit 2>/dev/null)}"
|
|
24
23
|
```
|
|
25
24
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
## 第 1 步:状态检测
|
|
29
|
-
|
|
30
|
-
如果存在 `docs/loop-handoff/latest.md`,先读取 handoff,确认上次 OpenTest 阶段、矩阵/验收/报告路径、阻塞项和下一步。handoff 只作为恢复线索,不替代 `.opentest.yaml`。
|
|
31
|
-
|
|
32
|
-
如果 `.opentest.yaml` 不存在,运行:
|
|
33
|
-
|
|
34
|
-
```bash
|
|
35
|
-
bash "$OPENTEST_STATE" init
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
然后运行:
|
|
39
|
-
|
|
40
|
-
```bash
|
|
41
|
-
bash "$OPENTEST_STATE" check
|
|
42
|
-
bash "$OPENTEST_DETECT" summary
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
## 第 2 步:阶段分发
|
|
46
|
-
|
|
47
|
-
读取 `phase`:
|
|
48
|
-
|
|
49
|
-
```bash
|
|
50
|
-
bash "$OPENTEST_STATE" get phase
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
分发规则:
|
|
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`。
|
|
63
|
-
|
|
64
|
-
若状态与可验证文件冲突,以文件状态为准,并用 `opentest-state.sh set` 修正;如存在 handoff,也同步更新 handoff 的“当前阶段/下一步/失败阻塞”。
|
|
65
|
-
|
|
66
|
-
## OpenTest-Driven Development 用法
|
|
67
|
-
|
|
68
|
-
当用户想“以测试驱动开发”,或需求包含前端交互、登录、表单、权限、API、数据写入、跨页面流程或高风险行为时,OpenTest 必须前置到 build 之前:
|
|
69
|
-
|
|
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 # 质量门报告
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
`plan` 阶段不能只复述需求。它必须主动检查:
|
|
81
|
-
|
|
82
|
-
- 主路径、失败路径、边界输入、空数据、权限、网络、重复提交、并发或过期状态。
|
|
83
|
-
- 前端反馈位置:字段下方、表单顶部、轻提示、模态框、行内状态、页面错误态。
|
|
84
|
-
- 证据分层:unit、component、integration、contract、E2E、smoke、visual/browser acceptance、security/review。
|
|
85
|
-
- 哪些证据是必需,哪些是不适用,哪些是 gap 或 risk-accepted 候选。
|
|
86
|
-
|
|
87
|
-
实现完成后,`OpenSuper verify` 可以引用 OpenTest 的 verification report,但不能替代 OpenTest 的矩阵、运行记录和验收证据。
|
|
88
|
-
|
|
89
|
-
## Loop Handoff 衔接
|
|
25
|
+
任一脚本缺失时停止,并提示安装 OpenTest。
|
|
90
26
|
|
|
91
|
-
|
|
27
|
+
## 分发
|
|
92
28
|
|
|
93
|
-
|
|
29
|
+
1. 若 `.opentest.yaml` 不存在,运行 `bash "$OPENTEST_STATE" init`。
|
|
30
|
+
2. 运行 `bash "$OPENTEST_STATE" check` 和 `bash "$OPENTEST_DETECT" summary`。
|
|
31
|
+
3. 用 `bash "$OPENTEST_STATE" get phase` 读取阶段。
|
|
32
|
+
4. 分发到 `opentest-plan`、`opentest-author`、`opentest-run`、`opentest-accept`、`opentest-verify`、`opentest-heal` 或 `opentest-archive`。
|
|
33
|
+
5. 面向人的产物使用已安装的 skill 语言。
|
|
@@ -25,3 +25,17 @@
|
|
|
25
25
|
`blocked` 证据必须包含原因,例如 MCP 不可用、环境不可用、缺少 seed data、需要认证,或外部服务失败。
|
|
26
26
|
|
|
27
27
|
UI 反馈证据应记录反馈实际出现的位置和形态,例如字段级行内错误、表单级警告、轻提示、模态框、页面级错误面板、禁用控件、加载指示或重试操作。
|
|
28
|
+
|
|
29
|
+
## 用例粒度规则
|
|
30
|
+
|
|
31
|
+
验收矩阵必须区分渲染验证、功能验证和副作用验证,不能把“界面能打开”当成完整验收。
|
|
32
|
+
|
|
33
|
+
- 渲染验证:确认入口、弹窗、表单、列表或关键控件能被真实页面渲染出来。
|
|
34
|
+
- 功能验证:确认用户完成关键操作后,业务结果真实生效。
|
|
35
|
+
- 副作用验证:确认操作完成后的弹窗、遮罩、loading、禁用态、toast 或错误态不会残留或误导下一步操作。
|
|
36
|
+
|
|
37
|
+
凡是有表单提交、创建、编辑、删除、上传、授权、状态流转或其他写操作的用例,必须包含“填写/输入 -> 提交/确认 -> 验证结果生效”的完整链路。示例:
|
|
38
|
+
|
|
39
|
+
- 地址表单能打开(渲染验证)。
|
|
40
|
+
- 能填写表单并提交,新地址出现在列表或详情中(功能验证)。
|
|
41
|
+
- 提交后弹窗关闭,页面无遮罩、无残留 loading,后续操作仍可继续(副作用验证)。
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# 完整测试工作流
|
|
2
|
+
|
|
3
|
+
只有当阶段 skill 要求读取详细覆盖规则时,才加载本引用。
|
|
4
|
+
|
|
5
|
+
## 默认证据链
|
|
6
|
+
|
|
7
|
+
```text
|
|
8
|
+
plan -> matrix -> fixtures -> tests -> run -> accept -> smoke -> pre-push -> verify -> archive
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## 测试数据
|
|
12
|
+
|
|
13
|
+
变更涉及数据、文件、角色、权限、API 或有状态流程时,创建 `docs/opentest/fixtures/`。
|
|
14
|
+
|
|
15
|
+
必需内容:
|
|
16
|
+
|
|
17
|
+
- 用户和角色
|
|
18
|
+
- 权限
|
|
19
|
+
- 有效、已存在、非法、重复、无权限、过期状态的实体
|
|
20
|
+
- 涉及上传、预览或媒体校验时的文件/图片
|
|
21
|
+
- seed 命令和幂等规则
|
|
22
|
+
- teardown 命令和清理范围
|
|
23
|
+
- UI、API、DB/存储、文件、日志断言
|
|
24
|
+
|
|
25
|
+
## CRUD 基线
|
|
26
|
+
|
|
27
|
+
涉及持久化数据、API、表单、文件或有状态流程时,矩阵包含:
|
|
28
|
+
|
|
29
|
+
- 新增:校验、成功、列表/详情可见
|
|
30
|
+
- 查询/列表/详情:列表、搜索、筛选、分页、空态、详情
|
|
31
|
+
- 修改:初始回显、校验失败、保存、回读
|
|
32
|
+
- 删除:确认、取消、成功、删除后不可见
|
|
33
|
+
- 失败/边界:非法、空、重复、无权限、过期、网络/API 错误
|
|
34
|
+
- 数据一致性:UI、API、DB/存储、文件、日志
|
|
35
|
+
- 端到端 CRUD:新增 -> 列表 -> 详情 -> 修改 -> 回读 -> 删除 -> 确认消失 -> 清理
|
|
36
|
+
|
|
37
|
+
不适用的环节必须在 `缺口/阻塞` 中写明原因。
|
|
38
|
+
|
|
39
|
+
## 交互验收硬规则
|
|
40
|
+
|
|
41
|
+
Playwright CLI、浏览器 MCP 或人工真实页面验收执行 CRUD、表单提交、文件上传、授权、状态流转等写操作时,必须包含提交后断言,不能只截图或只确认页面未崩溃。
|
|
42
|
+
|
|
43
|
+
推荐执行链路:
|
|
44
|
+
|
|
45
|
+
```text
|
|
46
|
+
open -> snapshot -> fill/input -> click(submit/confirm) -> snapshot -> read/assert changed result -> screenshot -> PASS/FAIL
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
- 写后读验证:提交后必须重新读取页面、列表、详情、API 响应、存储记录或日志中的至少一个可信结果面,确认值已变更。
|
|
50
|
+
- 弹窗/遮罩验证:写操作成功后必须断言弹窗关闭、遮罩移除、loading 停止、按钮状态恢复,且下一步可操作。
|
|
51
|
+
- 失败路径验证:校验失败、权限失败、网络/API 错误时,必须断言错误反馈位置、输入保留策略和可恢复路径。
|
|
52
|
+
- 证据记录:PASS 必须说明断言到的变更结果;若无法读取结果面,状态应为 `blocked` 或 `risk-accepted`,并写明原因。
|
|
53
|
+
|
|
54
|
+
## 运行质量门
|
|
55
|
+
|
|
56
|
+
- targeted:与变更矩阵行相关的证据
|
|
57
|
+
- fast:type、lint、unit
|
|
58
|
+
- full:项目完整测试集
|
|
59
|
+
- ci-like:CI 顺序
|
|
60
|
+
- pre-push:format/check、lint、type、unit、targeted integration、smoke、`git diff --check`
|
|
61
|
+
|
|
62
|
+
默认代码测试命令是 `python -m pytest`。覆盖率命令是 `python -m pytest --cov=. --cov-report=term-missing`。
|
|
63
|
+
|
|
64
|
+
## Verify 质量门
|
|
65
|
+
|
|
66
|
+
适用的高风险变更缺少必需 fixtures、seed/teardown、冒烟、pre-push、覆盖率、CRUD 或全链路验收证据时,不允许通过。
|
|
@@ -5,21 +5,19 @@ description: "OpenTest 阶段 4:执行自然语言验收、MCP 验收或真实
|
|
|
5
5
|
|
|
6
6
|
# OpenTest Accept
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
执行必需验收项,并把 PASS、FAIL 或 blocked evidence 回写到用例和矩阵。
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
## 必读引用
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
2. 对前端交互,优先用 Chrome DevTools MCP 执行真实页面验收。
|
|
16
|
-
3. 对 API 或后台链路,使用项目已有命令或直接 API 检查。
|
|
17
|
-
4. 对反馈类场景,必须观察实际呈现位置和形态;例如字段错误不能只记录“失败”,要记录是否在字段下方、表单顶部、轻提示、模态框或页面错误区显示。
|
|
18
|
-
5. 工具、环境或前置数据不可用时,记录 blocked evidence。
|
|
19
|
-
6. 更新验收记录。
|
|
20
|
-
7. 更新 `docs/loop-handoff/latest.md`(如果项目使用 Loop Handoff),记录验收结果、截图/步骤证据路径、blocked evidence 和下一步。
|
|
21
|
-
8. 运行 `bash "$OPENTEST_GUARD" accept --apply`。
|
|
12
|
+
- `opentest/references/acceptance-evidence.md`
|
|
13
|
+
- `opentest/references/complete-testing-workflow.md`
|
|
14
|
+
- `opentest/templates/acceptance-template.md`
|
|
22
15
|
|
|
23
|
-
##
|
|
16
|
+
## 步骤
|
|
24
17
|
|
|
25
|
-
|
|
18
|
+
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`。
|
|
@@ -1,30 +1,24 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: opentest-author
|
|
3
|
-
description: "OpenTest 阶段 2
|
|
3
|
+
description: "OpenTest 阶段 2:根据矩阵补齐测试资产、fixtures 和自然语言验收用例。"
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# OpenTest Author
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
把矩阵转成可执行测试、fixtures、seed/teardown 说明和验收用例。
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
## 必读引用
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
- `opentest/references/opentest-driven-development.md`
|
|
13
|
+
- `opentest/references/complete-testing-workflow.md`
|
|
14
|
+
- `opentest/templates/fixtures-template.md`
|
|
15
|
+
- `opentest/templates/acceptance-template.md`
|
|
13
16
|
|
|
14
17
|
## 步骤
|
|
15
18
|
|
|
16
|
-
1. 读取 `.opentest.yaml`
|
|
17
|
-
2.
|
|
18
|
-
3.
|
|
19
|
-
4.
|
|
20
|
-
5.
|
|
21
|
-
6.
|
|
22
|
-
7. 对前端反馈类用例,写清反馈位置和形态,例如字段下方错误、表单顶部错误、轻提示、模态框、行内状态或页面错误态。
|
|
23
|
-
8. 对不适用或当前无法补齐的证据,记录原因和风险。
|
|
24
|
-
9. 写入 `.opentest.yaml` 的 `fixtures` 和 `acceptance` 字段。
|
|
25
|
-
10. 更新 `docs/loop-handoff/latest.md`(如果项目使用 Loop Handoff),记录 fixtures、seed/teardown、测试资产、自然语言验收用例、gap/risk 和下一步。
|
|
26
|
-
11. 运行 `bash "$OPENTEST_GUARD" author --apply`。
|
|
27
|
-
|
|
28
|
-
## 现有技能路由
|
|
29
|
-
|
|
30
|
-
当矩阵要求代码级测试证据时,优先加载现有 TDD guidance。若项目规则要求特定测试框架,遵循项目规则。若项目没有测试框架,默认使用 pytest,不临时发明自定义测试壳。若当前任务更适合真实验收而不是新增测试框架代码,记录原因并交给 `opentest-accept`。
|
|
19
|
+
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`。
|
|
@@ -5,32 +5,23 @@ description: "OpenTest 阶段 1:分析变更、风险和项目事实,生成
|
|
|
5
5
|
|
|
6
6
|
# OpenTest Plan
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
在实现前生成 `docs/opentest/plans/`、`docs/opentest/matrices/` 和测试数据计划。
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
## 必读引用
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
- `opentest/references/codex-harness-coverage-heuristics.md`
|
|
13
|
+
- `opentest/references/matrix-format.md`
|
|
14
|
+
- `opentest/references/complete-testing-workflow.md`
|
|
13
15
|
|
|
14
16
|
## 步骤
|
|
15
17
|
|
|
16
|
-
1.
|
|
17
|
-
2.
|
|
18
|
-
3.
|
|
19
|
-
4.
|
|
20
|
-
5.
|
|
21
|
-
6.
|
|
22
|
-
7. 生成窄矩阵,至少包含 `ID`、`意图`、`覆盖维度`、`触发/输入`、`期望行为`、`风险`、`证据层级`、`框架/命令`、`必需证据`、`缺口/阻塞`、`状态`。
|
|
23
|
-
8. 对适用但未覆盖的证据面标记 `gap`,并写清具体阻塞或恢复路径,不把覆盖状态留成 unknown。
|
|
24
|
-
9. 写入 `.opentest.yaml` 的 `plan`、`matrix` 和 `fixtures` 字段。
|
|
25
|
-
10. 更新 `docs/loop-handoff/latest.md`(如果项目使用 Loop Handoff),记录 plan、matrix、fixtures 路径、当前阶段和下一步。
|
|
26
|
-
11. 运行 `bash "$OPENTEST_GUARD" plan --apply`。
|
|
18
|
+
1. 读取项目规则、需求/设计/diff、现有命令和 detect 输出。
|
|
19
|
+
2. 判断风险、适用覆盖面、测试数据,以及代码测试使用项目框架还是默认 `pytest`。
|
|
20
|
+
3. 数据写入、API、表单、文件或有状态流程默认套用 CRUD 基线和测试数据要求。
|
|
21
|
+
4. 生成矩阵,包含覆盖维度、框架/命令、必需证据、缺口/阻塞和状态。
|
|
22
|
+
5. 写入 `.opentest.yaml` 的 `plan`、`matrix`、`fixtures`。
|
|
23
|
+
6. 如存在 handoff,同步 plan/matrix/fixtures 路径,然后运行 `bash "$OPENTEST_GUARD" plan --apply`。
|
|
27
24
|
|
|
28
|
-
##
|
|
25
|
+
## 质量门
|
|
29
26
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
不要把所有证据都写成 unit test。矩阵要明确哪些用 unit/component/integration/contract/E2E/smoke/browser acceptance/security review 证明。
|
|
33
|
-
|
|
34
|
-
覆盖完整性指每个适用的产品行为、失败路径、边界和风险面都有必需证据,或有明确的 gap/blocker;不是要求每次任务都跑所有测试类型。
|
|
35
|
-
|
|
36
|
-
CRUD 基线和测试数据是数据写入类变更的默认要求。若某个 CRUD 环节不适用,必须在矩阵中写明原因。
|
|
27
|
+
每个适用行为、失败路径、边界和风险面都要有证据或明确 gap/blocker。CRUD 基线和测试数据默认必需;不适用时必须在矩阵写明原因。
|
|
@@ -1,34 +1,31 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: opentest-run
|
|
3
|
-
description: "OpenTest 阶段 3:按 targeted、fast、full 或
|
|
3
|
+
description: "OpenTest 阶段 3:按 targeted、fast、full、ci-like 或 pre-push 模式运行项目测试命令。"
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# OpenTest Run
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
运行矩阵驱动的命令,并把证据写到 `docs/opentest/runs/`。
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
## 必读引用
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
- `targeted`:只运行与矩阵相关的测试命令。
|
|
15
|
-
- `fast`:运行快速反馈命令,例如 type、lint、unit。
|
|
16
|
-
- `full`:运行项目完整测试命令。
|
|
17
|
-
- `ci-like`:尽量复现 CI 验证顺序。
|
|
18
|
-
- `pre-push`:push 或发布前运行推送质量门序列。
|
|
12
|
+
- `opentest/references/command-routing.md`
|
|
13
|
+
- `opentest/references/complete-testing-workflow.md`
|
|
19
14
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
如果 `.opentest.yaml` 中 `test_framework: pytest`,或矩阵要求代码级测试但项目没有声明测试框架,默认测试命令使用 `python -m pytest`。当矩阵要求覆盖率证据时,优先使用 `python -m pytest --cov=. --cov-report=term-missing`,并把覆盖率输出路径写入 `.opentest.yaml` 的 `coverage_report`。如果缺少 pytest 或 pytest-cov,记录 `missing command` 和安装/恢复步骤,不允许直接通过质量门。
|
|
15
|
+
## 模式
|
|
23
16
|
|
|
24
|
-
|
|
17
|
+
- `targeted`:只跑矩阵相关命令。
|
|
18
|
+
- `fast`:type/lint/unit 快速反馈。
|
|
19
|
+
- `full`:项目完整命令集。
|
|
20
|
+
- `ci-like`:尽量复现 CI 顺序。
|
|
21
|
+
- `pre-push`:push 质量门。
|
|
25
22
|
|
|
26
23
|
## 步骤
|
|
27
24
|
|
|
28
|
-
1. 读取
|
|
29
|
-
2.
|
|
30
|
-
3.
|
|
31
|
-
4.
|
|
32
|
-
5.
|
|
33
|
-
6.
|
|
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`。
|
|
34
31
|
7. 运行 `bash "$OPENTEST_GUARD" run --apply`。
|
|
@@ -5,25 +5,20 @@ description: "OpenTest 阶段 5:应用质量门并生成验证报告。"
|
|
|
5
5
|
|
|
6
6
|
# OpenTest Verify
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
应用质量门,并写入 `verification_report` 与 `verification_result`。
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
## 必读引用
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
- `opentest/references/quality-gate.md`
|
|
13
|
+
- `opentest/references/complete-testing-workflow.md`
|
|
14
|
+
- `opentest/templates/report-template.md`
|
|
13
15
|
|
|
14
|
-
|
|
16
|
+
## 步骤
|
|
15
17
|
|
|
16
|
-
按 build、type、lint、test、security、diff
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
- 测试数据可追踪:数据写入或 CRUD 变更必须有 fixture、seed、teardown 和清理证据。
|
|
24
|
-
- 必须有冒烟证据,除非矩阵明确标记 smoke 不适用。
|
|
25
|
-
- push/publish 前必须有 pre-push 证据;除非用户明确跳过,并在报告里记录风险。
|
|
26
|
-
- 高风险行为不能因为没有工具、没有测试框架或没有 seed data 就直接通过。
|
|
27
|
-
- 如果要求代码级覆盖率且 `test_framework: pytest` 生效,报告必须包含 `python -m pytest` 命令结果和 `coverage_report` 路径;否则必须 fail/block 并写明原因。
|
|
28
|
-
- blocked evidence 必须包含阻塞原因和后续恢复路径。
|
|
29
|
-
- 若产品行为失败,不进入 `heal` 修测试资产;应返回实现或需求修正。
|
|
18
|
+
1. 按 build、type、lint、test、security、diff 组织证据。
|
|
19
|
+
2. 每个 required evidence 必须有 pass、fail、blocked 或 risk-accepted。
|
|
20
|
+
3. 检查覆盖完整性:每个适用覆盖维度都有证据,或有带恢复路径的 gap/blocker。
|
|
21
|
+
4. 除非矩阵标记不适用,否则必须有冒烟证据。
|
|
22
|
+
5. push/publish 前必须有 pre-push 证据;用户明确跳过时要记录风险。
|
|
23
|
+
6. CRUD/数据变更按适用性要求测试数据、fixture、seed、teardown、清理和 `coverage_report` 证据。
|
|
24
|
+
7. 不能因为缺工具、fixture、seed data 或测试框架就让高风险行为通过。
|
package/package.json
CHANGED
package/scripts/smoke-test.js
CHANGED
|
@@ -242,6 +242,35 @@ function assertCompleteTestingWorkflowContracts() {
|
|
|
242
242
|
assert(chineseVerify.includes('必须有冒烟证据') && chineseVerify.includes('必须有 pre-push 证据') && chineseVerify.includes('测试数据'), '[VERIFY] Chinese verify skill must gate smoke, pre-push, and test data');
|
|
243
243
|
}
|
|
244
244
|
|
|
245
|
+
function assertProgressiveDisclosureContracts() {
|
|
246
|
+
const stageSkillPaths = [
|
|
247
|
+
'assets/skills/opentest/SKILL.md',
|
|
248
|
+
'assets/skills/opentest-plan/SKILL.md',
|
|
249
|
+
'assets/skills/opentest-author/SKILL.md',
|
|
250
|
+
'assets/skills/opentest-run/SKILL.md',
|
|
251
|
+
'assets/skills/opentest-accept/SKILL.md',
|
|
252
|
+
'assets/skills/opentest-verify/SKILL.md',
|
|
253
|
+
'assets/skills-zh/opentest/SKILL.md',
|
|
254
|
+
'assets/skills-zh/opentest-plan/SKILL.md',
|
|
255
|
+
'assets/skills-zh/opentest-author/SKILL.md',
|
|
256
|
+
'assets/skills-zh/opentest-run/SKILL.md',
|
|
257
|
+
'assets/skills-zh/opentest-accept/SKILL.md',
|
|
258
|
+
'assets/skills-zh/opentest-verify/SKILL.md',
|
|
259
|
+
];
|
|
260
|
+
|
|
261
|
+
for (const skillPath of stageSkillPaths) {
|
|
262
|
+
const content = readFileSync(skillPath, 'utf8');
|
|
263
|
+
assert(content.length <= 1800, `[DISCLOSURE] ${skillPath} must stay concise and move detail into references`);
|
|
264
|
+
assert(
|
|
265
|
+
content.includes('Required references') || content.includes('必读引用'),
|
|
266
|
+
`[DISCLOSURE] ${skillPath} must declare required references near the top`,
|
|
267
|
+
);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
const manifestText = readFileSync('assets/manifest.json', 'utf8');
|
|
271
|
+
assert(manifestText.includes('opentest/references/complete-testing-workflow.md'), '[DISCLOSURE] manifest must ship complete testing workflow reference');
|
|
272
|
+
}
|
|
273
|
+
|
|
245
274
|
async function assertPrepublishRejectsPublishSecretTextFiles() {
|
|
246
275
|
const fixtureDir = path.join('assets', 'opentest-smoke-secret-fixtures');
|
|
247
276
|
const fixtures = [
|
|
@@ -547,6 +576,7 @@ assertManifestStructure();
|
|
|
547
576
|
assertPrepublishGateCoversManifestAssets();
|
|
548
577
|
assertDefaultPytestContracts();
|
|
549
578
|
assertCompleteTestingWorkflowContracts();
|
|
579
|
+
assertProgressiveDisclosureContracts();
|
|
550
580
|
assertOpenTestSearchRootsCoverPlatforms();
|
|
551
581
|
assertLanguageAssetContracts();
|
|
552
582
|
await assertPrepublishRejectsPublishSecretTextFiles();
|