spec-lite 1.5.2 → 1.7.0
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/README.md +14 -8
- package/package.json +1 -1
- package/skills/ado-create/SKILL.md +1 -1
- package/skills/archive/SKILL.md +63 -52
- package/skills/artifact-audit/SKILL.md +3 -3
- package/skills/artifact-migrate/SKILL.md +3 -3
- package/skills/spec-brownfield-feature/SKILL.md +1 -1
- package/skills/spec-frd/SKILL.md +17 -10
- package/skills/spec-new/SKILL.md +15 -11
- package/skills/spec-test/SKILL.md +60 -59
- package/skills/spec-test-design/SKILL.md +243 -0
- package/skills/spec-test-exec/SKILL.md +251 -0
- package/skills-overview.md +43 -29
- package/templates/integrations/test-template.md +47 -25
- package/templates/main/feature/frd-template.md +43 -8
- package/templates/main/feature/test-design-template.md +289 -0
- package/templates/main/prd-template.md +2 -0
- package/templates/test-executions/test-exec-dm-template.md +83 -0
- package/templates/test-executions/test-exec-e2e-auto-template.md +299 -0
- package/templates/test-executions/test-exec-e2e-manual-template.md +231 -0
- package/templates/test-executions/test-exec-func-auto-template.md +155 -0
- package/templates/test-executions/test-exec-func-manual-template.md +203 -0
- package/templates/test-executions/test-exec-nfr-template.md +88 -0
- package/skills/spec-tsd/SKILL.md +0 -241
- package/templates/main/feature/tsd-template.md +0 -238
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: spec-test
|
|
3
|
-
description: Tạo test.md cho một integration bằng cách mechanical derive Test Scenarios + Test Cases từ Flows/US/AC/VR/FAC trong frd.md. Auto-cascade lên feature/{F-XXX}/
|
|
3
|
+
description: Tạo test.md cho một integration bằng cách mechanical derive Test Scenarios + Test Cases từ Flows/US/AC/VR/FAC trong frd.md. Auto-cascade lên feature/{F-XXX}/test-design.md. Role QC, song song với /spec-tech (DEV) — cả hai chỉ phụ thuộc spec.md approved.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# spec-test
|
|
@@ -9,15 +9,15 @@ description: Tạo test.md cho một integration bằng cách mechanical derive
|
|
|
9
9
|
|
|
10
10
|
Tạo `test.md` cho một integration trong `.specs/integrations/{slug}/`.
|
|
11
11
|
|
|
12
|
-
`test.md` là verification design ở integration level — định nghĩa **how to verify** rằng integration đáp ứng `spec.md`. Nội dung gồm Test Strategy (per integration) + Changes blocks cascade lên feature `
|
|
12
|
+
`test.md` là verification design ở integration level — định nghĩa **how to verify** rằng integration đáp ứng `spec.md`. Nội dung gồm Test Strategy (per integration) + Changes blocks cascade lên feature `test-design.md` (Test Design Document).
|
|
13
13
|
|
|
14
14
|
**Hai artifact tách bạch:**
|
|
15
15
|
- `.specs/integrations/{slug}/test.md` — integration-level, ephemeral, PR record bất biến sau approve (single-word naming như `spec.md` / `tech.md` / `plan.md`).
|
|
16
|
-
- `.specs/main/feature/{F-XXX}-{slug}/
|
|
16
|
+
- `.specs/main/feature/{F-XXX}-{slug}/test-design.md` — feature-level, persistent canonical artifact (cùng nhóm main feature như `frd.md` / `fdd.md`). TC content cuối cùng nằm ở đây.
|
|
17
17
|
|
|
18
18
|
**Role:** QC. Song song với `/spec-tech` (DEV role). Cả hai chỉ phụ thuộc `spec.md` approved — không có thứ tự bắt buộc giữa chúng.
|
|
19
19
|
|
|
20
|
-
**Cốt lõi:** agent **mechanical derive** TC từ frd.md (mỗi Flow → TS, mỗi US/AC → Functional TC, mỗi VR → Validation TC positive+negative, mỗi FAC →
|
|
20
|
+
**Cốt lõi:** agent **mechanical derive** TC từ frd.md (mỗi Flow → TS, mỗi US/AC → Functional TC, mỗi VR → Validation TC positive+negative, mỗi FAC → E2E TC, mỗi NFR → Non-functional TC, mỗi DM → Data & Migration TC). Agent KHÔNG sáng tạo TC ngoài frd — phần đó là QC thêm tay khi review.
|
|
21
21
|
|
|
22
22
|
## When to Use
|
|
23
23
|
|
|
@@ -27,7 +27,7 @@ Tạo `test.md` cho một integration trong `.specs/integrations/{slug}/`.
|
|
|
27
27
|
## When NOT to Use
|
|
28
28
|
|
|
29
29
|
- `spec.md` chưa có hoặc chưa approve → chạy `/spec-new` trước
|
|
30
|
-
- Integration có `features: []` (không touch feature nào) → `test.md` không áp dụng vì component-level `
|
|
30
|
+
- Integration có `features: []` (không touch feature nào) → `test.md` không áp dụng vì component-level `test-design.md` không tồn tại trong kit này (xem `templates/main/feature/test-design-template.md` — component contract verify gián tiếp qua feature TC + unit test trong code). Verification cho integration thuần component → đặt trong tech.md hoặc phase Verification của plan.md.
|
|
31
31
|
- Chỉ muốn cập nhật `test.md` đã có → edit file trực tiếp
|
|
32
32
|
|
|
33
33
|
---
|
|
@@ -90,8 +90,8 @@ Nếu `status` **không phải** `approved`:
|
|
|
90
90
|
|
|
91
91
|
> ⛔ Integration **{slug}** không touch feature nào (`features: []`).
|
|
92
92
|
>
|
|
93
|
-
> `/spec-test` cascade lên `feature/{F-XXX}/
|
|
94
|
-
> Component contract được verify gián tiếp qua feature TC + unit test trong code (xem `templates/main/feature/
|
|
93
|
+
> `/spec-test` cascade lên `feature/{F-XXX}/test-design.md` — không áp dụng cho integration thuần component.
|
|
94
|
+
> Component contract được verify gián tiếp qua feature TC + unit test trong code (xem `templates/main/feature/test-design-template.md`).
|
|
95
95
|
>
|
|
96
96
|
> Đặt verification cho integration này trong:
|
|
97
97
|
> - `tech.md > Implementation Notes` — verification approach
|
|
@@ -109,7 +109,7 @@ Load các file sau:
|
|
|
109
109
|
|
|
110
110
|
- `.specs/integrations/{slug}/spec.md` — đọc toàn bộ + frontmatter (`features`)
|
|
111
111
|
- `.specs/main/feature/{F-XXX}-{slug}/frd.md` — cho mỗi feature trong frontmatter `features` (source của TC — bắt buộc tồn tại vì cascade từ spec.md đã apply)
|
|
112
|
-
- `.specs/main/feature/{F-XXX}-{slug}/
|
|
112
|
+
- `.specs/main/feature/{F-XXX}-{slug}/test-design.md` — cho mỗi feature trong frontmatter `features` (nếu tồn tại — cần để diff và assign next ID)
|
|
113
113
|
- `.specs/integrations/{slug}/tech.md` — đọc nếu tồn tại (optional, dùng để hint environment / data set / NFR perf threshold)
|
|
114
114
|
|
|
115
115
|
Tóm tắt context:
|
|
@@ -119,8 +119,8 @@ TÔI HIỂU:
|
|
|
119
119
|
- Integration: {title}
|
|
120
120
|
- Features touched: {từ frontmatter — F-XXX, ...}
|
|
121
121
|
- Mỗi feature có trong frd.md:
|
|
122
|
-
- F-XXX: {N} Flows, {M} US ({K} AC), {P} VR, {Q} FAC
|
|
123
|
-
-
|
|
122
|
+
- F-XXX: {N} Flows, {M} US ({K} AC), {P} VR, {Q} FAC, {R} NFR, {S} DM
|
|
123
|
+
- test-design.md hiện tại:
|
|
124
124
|
- F-XXX: tồn tại — max(TS)=NNN, max(TC)=MMM (cho operation=update)
|
|
125
125
|
- F-YYY: chưa tồn tại (cho operation=create)
|
|
126
126
|
- tech.md: {tồn tại / chưa — nếu có thì có hint gì cho env/data/perf}
|
|
@@ -139,11 +139,11 @@ Nếu frd.md của feature nào không tồn tại → báo lỗi và dừng (l
|
|
|
139
139
|
|
|
140
140
|
Với mỗi feature trong `features:`:
|
|
141
141
|
|
|
142
|
-
- Đọc `feature/{F-XXX}/
|
|
142
|
+
- Đọc `feature/{F-XXX}/test-design.md` hiện tại (nếu có) để lấy `max(TS-F{NNN}-seq)` và `max(TC-F{NNN}-seq)`
|
|
143
143
|
- ID mới = `max(seq) + 1`, format 3 chữ số
|
|
144
|
-
- TC dùng **chung sequence** cho Functional / Validation /
|
|
144
|
+
- TC dùng **chung sequence** cho Functional / Validation / E2E / Non-functional / Data & Migration — không reset theo loại, không đẻ prefix riêng
|
|
145
145
|
- ID **stable** — không tái sử dụng khi [REMOVE], không renumber khi [MODIFY]
|
|
146
|
-
- Operation=create (
|
|
146
|
+
- Operation=create (test-design.md chưa tồn tại) → bắt đầu từ `001`
|
|
147
147
|
|
|
148
148
|
#### 3.2 Derivation rules
|
|
149
149
|
|
|
@@ -176,14 +176,13 @@ Với mỗi feature trong `features:`:
|
|
|
176
176
|
- Covers: `VR-{F_ID}-{seq}`
|
|
177
177
|
- Priority: P1 mặc định (xem 3.3)
|
|
178
178
|
|
|
179
|
-
**D.
|
|
179
|
+
**D. E2E Test Cases** — mỗi `FAC-*` (end-to-end) → 1 TC. Type: `E2E — journey` (tuần tự liên story) / `E2E — consistency` (đa màn) / `E2E — integrity` (bất biến liên story, không tuần tự) — đọc FAC để phân loại. Covers `FAC-{F_ID}-{seq}`. Spans: list US IDs (nếu journey/integrity). Preconditions/Steps/Expected dịch 1:1 từ G/W/T.
|
|
180
180
|
|
|
181
|
-
- TC
|
|
182
|
-
|
|
183
|
-
-
|
|
184
|
-
|
|
185
|
-
-
|
|
186
|
-
- Preconditions/Steps/Expected: dịch 1:1 từ Given/When/Then của FAC
|
|
181
|
+
**D2. Non-Functional Test Cases** — mỗi `NFR-*` → 1 TC. Type: `performance` / `a11y` / `security` / ... (theo NFR). Covers `NFR-{F_ID}-{seq}`. Dịch 1:1 từ G/W/T.
|
|
182
|
+
|
|
183
|
+
**D3. Data & Migration Test Cases** (required-emptyable) — mỗi `DM-*` → 1 TC. Type: `data migration`. Covers `DM-{F_ID}-{seq}`. Dịch 1:1 từ G/W/T. Frd không có DM entry → giữ heading, để section trống.
|
|
184
|
+
|
|
185
|
+
> Mọi TC ở D / D2 / D3 dùng **chung sequence `TC-F{NNN}-{next_seq}`** — KHÔNG đẻ prefix riêng. Priority theo bảng ở 3.3.
|
|
187
186
|
|
|
188
187
|
**E. Traceability Matrix** — row per frd item:
|
|
189
188
|
|
|
@@ -191,7 +190,9 @@ Với mỗi feature trong `features:`:
|
|
|
191
190
|
- 1 row per US → cover by TC (Functional)
|
|
192
191
|
- 1 row per Story AC → cover by TC (Functional)
|
|
193
192
|
- 1 row per VR → cover by TC (Validation, list tất cả positive + negative)
|
|
194
|
-
- 1 row per FAC → cover by TC (
|
|
193
|
+
- 1 row per FAC → cover by TC (E2E)
|
|
194
|
+
- 1 row per NFR → cover by TC (Non-functional)
|
|
195
|
+
- 1 row per DM → cover by TC (Data & Migration)
|
|
195
196
|
- Mọi item phải có cover ✅ (vì derive 1:1). Nếu agent không thể derive một item nào → đánh dấu ❌ + ghi lý do ở Gaps section, KHÔNG silent skip.
|
|
196
197
|
|
|
197
198
|
#### 3.3 Priority defaults
|
|
@@ -208,19 +209,20 @@ Mọi TC đều có priority deterministic. QC override khi review (Bước 4).
|
|
|
208
209
|
|
|
209
210
|
**TC cover VR** — inherit max priority của các US trong `Refs` column của VR. Nếu Refs trống → P1 default.
|
|
210
211
|
|
|
211
|
-
**TC cover FAC** — theo
|
|
212
|
+
**TC cover FAC / NFR / DM** — theo loại + section nguồn:
|
|
212
213
|
|
|
213
|
-
|
|
|
214
|
+
| Loại | TC Priority |
|
|
214
215
|
| --- | --- |
|
|
215
|
-
|
|
|
216
|
-
|
|
|
217
|
-
|
|
|
216
|
+
| FAC — end-to-end (journey) | P0 |
|
|
217
|
+
| FAC — integrity | P0 |
|
|
218
|
+
| FAC — consistency | P1 |
|
|
219
|
+
| NFR — security | P0 |
|
|
218
220
|
| NFR — performance / a11y / i18n / browser | P1 |
|
|
219
221
|
| Data & migration | P0 |
|
|
220
222
|
|
|
221
|
-
#### 3.4 Diff vs current
|
|
223
|
+
#### 3.4 Diff vs current test-design.md
|
|
222
224
|
|
|
223
|
-
Với feature có
|
|
225
|
+
Với feature có test-design.md hiện tại (operation=update):
|
|
224
226
|
|
|
225
227
|
- Item đã có TC cover → KHÔNG sinh TC mới, giữ nguyên TC cũ
|
|
226
228
|
- Item trong frd nhưng chưa có TC cover → sinh TC mới với marker `[NEW]`
|
|
@@ -229,7 +231,7 @@ Với feature có tsd.md hiện tại (operation=update):
|
|
|
229
231
|
|
|
230
232
|
Agent compute diff tự động — KHÔNG hỏi user "field nào đã đổi"; đọc 2 file rồi đối chiếu.
|
|
231
233
|
|
|
232
|
-
**No-delta case:** nếu diff giữa frd hiện tại và
|
|
234
|
+
**No-delta case:** nếu diff giữa frd hiện tại và test-design.md hiện tại = empty cho 1 feature (frd không thêm/đổi item nào mà test-design chưa cover) → **bỏ Changes block của feature đó hoàn toàn**, ghi `no-op` trong Cascade Summary để minh bạch.
|
|
233
235
|
|
|
234
236
|
#### 3.5 Placeholders cần QC fill
|
|
235
237
|
|
|
@@ -237,8 +239,7 @@ Agent **không suy đoán** các field sau, dùng placeholder rõ ràng để QC
|
|
|
237
239
|
|
|
238
240
|
| Field | Placeholder | Vì sao agent không tự fill |
|
|
239
241
|
| --- | --- | --- |
|
|
240
|
-
|
|
|
241
|
-
| Test Data table | Row `{TBD — fixture}` cho mỗi seed/boundary dataset agent thấy cần | QC chọn fixture source thực tế |
|
|
242
|
+
| Test Data Requirements | Row `{TBD — shape}` cho mỗi seed/boundary dataset agent thấy cần | QC xác định yêu cầu data (shape); nguồn/refresh thuộc execution |
|
|
242
243
|
| Out of Scope | Để trống với note `<!-- QC fill -->` | Quyết định business của QC |
|
|
243
244
|
| Test Strategy > Approach | Bullet generic theo template gốc | Strategy đặc thù integration QC fill |
|
|
244
245
|
|
|
@@ -249,8 +250,8 @@ Agent **không suy đoán** các field sau, dùng placeholder rõ ràng để QC
|
|
|
249
250
|
Tổng hợp và viết draft `test.md` theo `templates/integrations/test-template.md`:
|
|
250
251
|
|
|
251
252
|
- **Context** — tóm tắt từ Bước 2
|
|
252
|
-
- **Test Strategy** —
|
|
253
|
-
- **Changes** — 1 block per feature *có delta*, mỗi block có operation + content theo template gốc `templates/main/feature/
|
|
253
|
+
- **Test Strategy** — Approach delta đặc thù integration (KHÔNG có Environments table — env assignment thuộc execution)
|
|
254
|
+
- **Changes** — 1 block per feature *có delta*, mỗi block có operation + content theo template gốc `templates/main/feature/test-design-template.md`. Feature no-delta → bỏ block.
|
|
254
255
|
- **Out of Scope** — empty với note QC fill
|
|
255
256
|
- **Open Questions** — list các item mà agent không thể derive deterministic (vd: FAC có wording vague, VR không rõ nhánh fail nào)
|
|
256
257
|
- **Cascade Summary** — table liệt kê **tất cả** feature trong `features:` (kể cả no-delta — ghi `no-op`)
|
|
@@ -263,14 +264,14 @@ Hiển thị **toàn bộ draft** cho QC xem — **chưa ghi file, chưa cascade
|
|
|
263
264
|
|
|
264
265
|
> Draft trên đã đúng chưa? QC điểm cần check:
|
|
265
266
|
>
|
|
266
|
-
> 1. **Mechanical derivation** — mỗi Flow / US / AC / VR / FAC trong frd đã có TC cover chưa? (xem Traceability Matrix)
|
|
267
|
+
> 1. **Mechanical derivation** — mỗi Flow / US / AC / VR / FAC / NFR / DM trong frd đã có TC cover chưa? (xem Traceability Matrix)
|
|
267
268
|
> 2. **Priority defaults** — có TC nào cần override khỏi default không?
|
|
268
|
-
> 3. **Placeholders** — fill
|
|
269
|
+
> 3. **Placeholders** — fill Test Data Requirements / Out of Scope / Strategy Approach.
|
|
269
270
|
> 4. **Extra edge cases** — ngoài AC/VR có scenario nào QC muốn thêm? (vd: exploratory, security boundary, race condition không có trong AC)
|
|
270
271
|
> 5. **Changes markers** — `[NEW]/[MODIFY]/[REMOVE]` có đúng không?
|
|
271
272
|
> 6. **No-delta features** — Cascade Summary có ghi `no-op` đúng cho feature không có delta không?
|
|
272
273
|
>
|
|
273
|
-
> **Sau khi confirm, agent sẽ auto-apply tất cả Changes blocks lên feature
|
|
274
|
+
> **Sau khi confirm, agent sẽ auto-apply tất cả Changes blocks lên feature test-design.md(s).**
|
|
274
275
|
|
|
275
276
|
Nếu QC yêu cầu chỉnh sửa:
|
|
276
277
|
- Override priority → update draft
|
|
@@ -286,25 +287,25 @@ Chỉ tiến hành Bước 6 sau khi QC confirm.
|
|
|
286
287
|
|
|
287
288
|
**[6.1] Ghi `.specs/integrations/{slug}/test.md`** với status `approved` (không phải `draft` — human đã confirm ở Bước 5 chính là approval). Frontmatter `features` mirror từ `spec.md`. (test.md là integration artifact — **không** mang `template_version`; versioning chỉ áp dụng cho main artifacts, xem `conventions.md` §7.)
|
|
288
289
|
|
|
289
|
-
**[6.2] Auto-apply mỗi Changes block** vào `feature/{F-XXX}/
|
|
290
|
+
**[6.2] Auto-apply mỗi Changes block** vào `feature/{F-XXX}/test-design.md` tương ứng. Thứ tự apply: theo thứ tự xuất hiện trong frontmatter `features` (deterministic, không có forward reference giữa các feature test-design.md). Bỏ qua feature có operation `no-op` trong Cascade Summary.
|
|
290
291
|
|
|
291
292
|
Cho từng block:
|
|
292
293
|
|
|
293
294
|
- **Operation=create:**
|
|
294
|
-
- Tạo file `.specs/main/feature/{F-XXX}-{slug}/
|
|
295
|
-
- Nội dung = nội dung của Changes block (theo format `templates/main/feature/
|
|
296
|
-
- Frontmatter của
|
|
295
|
+
- Tạo file `.specs/main/feature/{F-XXX}-{slug}/test-design.md`
|
|
296
|
+
- Nội dung = nội dung của Changes block (theo format `templates/main/feature/test-design-template.md`)
|
|
297
|
+
- Frontmatter của test-design.md mới: status `draft` + `template_version` copy từ `test-design-template.md` (separate lifecycle với integration test.md). Chỉ stamp ở operation=create; **operation=update KHÔNG đụng** version của test-design.md hiện có.
|
|
297
298
|
|
|
298
299
|
- **Operation=update:**
|
|
299
|
-
- Đọc
|
|
300
|
+
- Đọc test-design.md hiện tại
|
|
300
301
|
- Với mỗi TS/TC trong Changes block:
|
|
301
302
|
- `[NEW]` → append/insert vào section tương ứng (giữ thứ tự numeric của ID)
|
|
302
303
|
- `[MODIFY {field}]` → tìm TS/TC bằng ID, update field đã chỉ định, giữ nguyên field khác
|
|
303
|
-
- `[REMOVE]` → xóa TS/TC khỏi
|
|
304
|
+
- `[REMOVE]` → xóa TS/TC khỏi test-design.md (ID retire, không tái sử dụng)
|
|
304
305
|
- Cập nhật Traceability Matrix: thêm row cho item mới, update row của item bị MODIFY, KHÔNG xóa row của REMOVE (đánh dấu retire)
|
|
305
|
-
- Ghi lại
|
|
306
|
+
- Ghi lại test-design.md
|
|
306
307
|
|
|
307
|
-
**[6.2.5] Append Change History entry** vào mỗi
|
|
308
|
+
**[6.2.5] Append Change History entry** vào mỗi test-design.md bị touched (theo `conventions.md` §5.5). Đây là phần atomic của auto-apply — nếu fail thì rollback luôn.
|
|
308
309
|
|
|
309
310
|
Format entry:
|
|
310
311
|
|
|
@@ -315,16 +316,16 @@ Format entry:
|
|
|
315
316
|
- [marker] {TS/TC ID} — {mô tả ngắn 1 dòng}
|
|
316
317
|
```
|
|
317
318
|
|
|
318
|
-
- Operation = `create` (
|
|
319
|
+
- Operation = `create` (test-design.md mới) | `update` (test-design.md đã tồn tại).
|
|
319
320
|
- Integration link trỏ tới `test.md` (không phải `spec.md`) — đây là cascade từ test.
|
|
320
|
-
- Section name = tên section trong template
|
|
321
|
+
- Section name = tên section trong template test-design (`Test Scenarios`, `Functional Test Cases`, `Validation Test Cases`, `E2E Test Cases`, `Non-Functional Test Cases`, `Data & Migration Test Cases`, `Traceability Matrix`...).
|
|
321
322
|
- Mọi TS/TC có marker trong Changes block phải xuất hiện ở entry, group theo section.
|
|
322
323
|
- Với operation=create từ template trống (no Changes block content) → entry body có thể là `- **All sections**: initial scaffold`.
|
|
323
324
|
|
|
324
325
|
**[6.3] Atomic rollback:** Nếu apply block nào fail (vd `[MODIFY TC-F001-005]` nhưng ID không tồn tại):
|
|
325
326
|
1. Rollback các block đã apply trước đó về state ban đầu
|
|
326
327
|
2. **Không** ghi integration test.md
|
|
327
|
-
3. Báo lỗi cụ thể cho QC fix draft hoặc feature
|
|
328
|
+
3. Báo lỗi cụ thể cho QC fix draft hoặc feature test-design.md hiện tại
|
|
328
329
|
|
|
329
330
|
**[6.4] Thông báo kết quả:**
|
|
330
331
|
|
|
@@ -332,12 +333,12 @@ Format entry:
|
|
|
332
333
|
✓ .specs/integrations/{slug}/test.md đã được tạo (status: approved)
|
|
333
334
|
|
|
334
335
|
Auto-cascade applied:
|
|
335
|
-
✓ feature/F-XXX-{slug}/
|
|
336
|
-
✓ feature/F-YYY-{slug}/
|
|
336
|
+
✓ feature/F-XXX-{slug}/test-design.md — {created | updated: +N TS, +M TC, modify K TC, remove L TC}
|
|
337
|
+
✓ feature/F-YYY-{slug}/test-design.md — no-op (frd không đổi)
|
|
337
338
|
|
|
338
339
|
Bước tiếp theo:
|
|
339
|
-
- QC: review feature
|
|
340
|
-
- DEV: có thể run /plan nếu chưa có plan.md (plan.md hiện chưa consume
|
|
340
|
+
- QC: review feature test-design.md đã cascade, fill remaining TBD nếu có
|
|
341
|
+
- DEV: có thể run /plan nếu chưa có plan.md (plan.md hiện chưa consume test-design.md — test tasks tự QC manage trong test framework)
|
|
341
342
|
```
|
|
342
343
|
|
|
343
344
|
---
|
|
@@ -348,7 +349,7 @@ Bước tiếp theo:
|
|
|
348
349
|
| --- | --- |
|
|
349
350
|
| "TC có thể nghĩ ra khi chạy test" | Không document = không có traceability. AC pass/fail không kiểm tra được nếu không có TC mapping. |
|
|
350
351
|
| "VR positive đủ rồi, negative skip" | Negative case là nơi bug ẩn. Mỗi nhánh fail của VR phải có TC riêng. |
|
|
351
|
-
| "Priority để default hết P1 cho nhanh" | Priority decorative thì cũng phải đúng — derive deterministic từ US Priority/FAC
|
|
352
|
+
| "Priority để default hết P1 cho nhanh" | Priority decorative thì cũng phải đúng — derive deterministic từ US Priority/loại requirement (FAC/NFR/DM). P1 hàng loạt = QC chưa nhìn frd. |
|
|
352
353
|
| "Out of Scope để trống cũng được" | Mọi integration đều có thứ không test. Trống = scope creep hoặc gap không kiểm soát. |
|
|
353
354
|
|
|
354
355
|
## Red Flags
|
|
@@ -357,8 +358,8 @@ Bước tiếp theo:
|
|
|
357
358
|
- TC có Covers trống → không trace được lên frd
|
|
358
359
|
- VR có ít hơn 2 TC (1 positive + 1+ negative) → coverage thiếu
|
|
359
360
|
- Priority hàng loạt giống nhau cho mọi TC → QC chưa override default
|
|
360
|
-
- Test Data toàn `TBD` sau khi QC review → chưa thật sự confirm
|
|
361
|
-
- Changes block có marker `[NEW]` cho TC trùng ID với TC đã có trong
|
|
361
|
+
- Test Data Requirements toàn `TBD` sau khi QC review → chưa thật sự confirm
|
|
362
|
+
- Changes block có marker `[NEW]` cho TC trùng ID với TC đã có trong test-design.md hiện tại → diff bug
|
|
362
363
|
- Cascade Summary thiếu row cho feature trong `features:` (kể cả no-op) → không minh bạch
|
|
363
364
|
|
|
364
365
|
## Verification
|
|
@@ -368,17 +369,17 @@ Trước khi QC confirm (Bước 5), kiểm tra:
|
|
|
368
369
|
- [ ] Mỗi Flow trong frd có 1 TS tương ứng
|
|
369
370
|
- [ ] Mỗi US AC có TC Functional cover
|
|
370
371
|
- [ ] Mỗi VR có ≥1 positive + ≥1 negative TC
|
|
371
|
-
- [ ] Mỗi FAC có TC
|
|
372
|
+
- [ ] Mỗi FAC có TC E2E cover; mỗi NFR có TC Non-functional; mỗi DM có TC Data & Migration
|
|
372
373
|
- [ ] Traceability Matrix đầy đủ (không ❌ mà không giải thích)
|
|
373
374
|
- [ ] Priority deterministic theo bảng 3.3 (default), QC override visible
|
|
374
375
|
- [ ] ID assignment từ max(seq)+1, không tái sử dụng, không renumber
|
|
375
|
-
- [ ] Markers `[NEW]/[MODIFY {field}]/[REMOVE]` khớp diff vs current
|
|
376
|
+
- [ ] Markers `[NEW]/[MODIFY {field}]/[REMOVE]` khớp diff vs current test-design.md
|
|
376
377
|
- [ ] Feature no-delta được ghi `no-op` trong Cascade Summary, KHÔNG có Changes block
|
|
377
378
|
|
|
378
379
|
Sau khi QC confirm (Bước 6):
|
|
379
380
|
|
|
380
381
|
- [ ] Auto-apply theo thứ tự features trong frontmatter
|
|
381
|
-
- [ ] Mỗi
|
|
382
|
+
- [ ] Mỗi test-design.md bị touched có entry mới trong `## Change History` (conventions §5.5)
|
|
382
383
|
- [ ] Fail-safe: nếu apply fail thì không ghi integration test.md (rollback luôn Change History entries)
|
|
383
|
-
- [ ] Mỗi feature
|
|
384
|
-
- [ ] Main artifact
|
|
384
|
+
- [ ] Mỗi feature test-design.md mới có status `draft` (separate lifecycle)
|
|
385
|
+
- [ ] Main artifact test-design.md create có `template_version` copy từ template; test-design.md update giữ nguyên version cũ. test.md (integration) KHÔNG mang `template_version`
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: spec-test-design
|
|
3
|
+
description: Tạo test-design.md (Test Design Document) trực tiếp tại feature level từ frd.md — mechanical derive Test Scenarios + Test Cases. KHÔNG cần integration, không cascade. Dùng cho brownfield onboarding (sau /spec-brownfield-feature) hoặc greenfield bootstrap khi feature đã có frd.md nhưng chưa có test-design.md.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# spec-test-design
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Tạo `.specs/main/feature/{F-XXX}-{slug}/test-design.md` trực tiếp từ frd.md của feature đó — **không qua integration**, không cascade.
|
|
11
|
+
|
|
12
|
+
Skill này song hành với `/spec-prd` và `/spec-sad`: skill có acronym suffix (`prd`/`sad`/`test-design`) → tạo main artifact trực tiếp. Phân biệt với `/spec-test` — skill đó tạo `test.md` integration-level và cascade qua Changes blocks.
|
|
13
|
+
|
|
14
|
+
## When to Use
|
|
15
|
+
|
|
16
|
+
- **Brownfield onboarding** — sau `/spec-brownfield-feature` đã sinh frd.md, cần bootstrap test-design.md để có test coverage tracking ngay từ đầu.
|
|
17
|
+
- **Greenfield deferred** — feature có frd.md từ lâu nhưng test-design.md chưa được tạo (vd: test design bị defer).
|
|
18
|
+
- **Ad-hoc rebuild** — test-design.md drift quá xa khỏi frd.md, muốn regenerate fresh.
|
|
19
|
+
|
|
20
|
+
## When NOT to Use
|
|
21
|
+
|
|
22
|
+
- Có integration mới và muốn cascade thay đổi frd lên test-design hiện tại → dùng `/spec-test` (changeset patch giữ ID stable)
|
|
23
|
+
- Chỉ muốn sửa vài TC → edit `test-design.md` trực tiếp
|
|
24
|
+
- Feature chưa có frd.md → chạy `/spec-brownfield-feature` (brownfield) hoặc `/spec-new` (greenfield) trước
|
|
25
|
+
|
|
26
|
+
## Cảnh báo về ID stability
|
|
27
|
+
|
|
28
|
+
`/spec-test-design` **regenerate IDs từ 001** mỗi lần chạy. Nếu test-design.md đã tồn tại và đang được reference (vd: test code có `// covers TC-F001-005`), rebuild sẽ làm vỡ những reference đó.
|
|
29
|
+
|
|
30
|
+
Quy tắc:
|
|
31
|
+
- **test-design.md chưa tồn tại** → an toàn, không có reference, regenerate fresh.
|
|
32
|
+
- **test-design.md tồn tại** → skill hỏi confirm rõ ràng trước khi overwrite. Khuyến nghị: dùng `/spec-test` qua integration changeset để preserve ID stable.
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Process
|
|
37
|
+
|
|
38
|
+
### Bước 1: Xác định feature
|
|
39
|
+
|
|
40
|
+
**Nếu có ARGUMENT:**
|
|
41
|
+
- Parse argument: có thể là feature ID (`F-001`, `001`) hoặc slug (`F-001-auth`, `auth`)
|
|
42
|
+
- Quét `.specs/main/feature/*/frd.md`, tìm feature khớp
|
|
43
|
+
- Nếu không tìm thấy → báo lỗi:
|
|
44
|
+
> Không tìm thấy feature khớp với "{argument}". Kiểm tra `.specs/main/feature/`.
|
|
45
|
+
|
|
46
|
+
**Nếu không có ARGUMENT:**
|
|
47
|
+
|
|
48
|
+
Quét `.specs/main/feature/`. Liệt kê **tất cả** features có `frd.md`, đánh dấu trạng thái test-design:
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
Features có frd.md:
|
|
52
|
+
|
|
53
|
+
[1] F-001 — auth spec✓ test-design✓
|
|
54
|
+
[2] F-002 — checkout spec✓ test-design—
|
|
55
|
+
[3] F-003 — refund spec✓ test-design— (frd có 5 Flow, 12 US, 8 VR, 3 FAC)
|
|
56
|
+
|
|
57
|
+
Chọn số feature:
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Nếu không có feature nào có frd → thông báo:
|
|
61
|
+
> Chưa có feature nào có frd.md. Hãy chạy `/spec-brownfield-feature` hoặc `/spec-new` trước.
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
### Bước 2: Gate check — frd.md tồn tại + warn nếu test-design.md đã có
|
|
66
|
+
|
|
67
|
+
**Check 1 — frd.md tồn tại:**
|
|
68
|
+
|
|
69
|
+
Nếu `.specs/main/feature/{F-XXX}-{slug}/frd.md` không tồn tại → dừng:
|
|
70
|
+
> ⛔ `feature/{F-XXX}-{slug}/frd.md` không tồn tại. `/spec-test-design` cần frd làm input.
|
|
71
|
+
|
|
72
|
+
**Check 2 — test-design.md đã tồn tại:**
|
|
73
|
+
|
|
74
|
+
Nếu `.specs/main/feature/{F-XXX}-{slug}/test-design.md` đã tồn tại:
|
|
75
|
+
|
|
76
|
+
> ⚠ `test-design.md` đã tồn tại cho feature **{F-XXX} — {slug}**.
|
|
77
|
+
>
|
|
78
|
+
> `/spec-test-design` regenerate IDs từ 001 — nếu có test code đang reference TC-{F_ID}-NNN hoặc TS-{F_ID}-NNN, references sẽ bị vỡ.
|
|
79
|
+
>
|
|
80
|
+
> Khuyến nghị: dùng `/spec-test` qua integration changeset để giữ ID stable.
|
|
81
|
+
>
|
|
82
|
+
> Tiếp tục overwrite? (yes / no — default no)
|
|
83
|
+
|
|
84
|
+
Nếu user chọn no → dừng, suggest `/spec-test`.
|
|
85
|
+
Nếu user chọn yes → backup test-design.md cũ thành `test-design.md.bak.{timestamp}` rồi proceed.
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
### Bước 3: Load context
|
|
90
|
+
|
|
91
|
+
Load các file sau:
|
|
92
|
+
|
|
93
|
+
- `.specs/main/feature/{F-XXX}-{slug}/frd.md` — **bắt buộc**, source của TC
|
|
94
|
+
- `.specs/main/feature/{F-XXX}-{slug}/fdd.md` — optional, đọc nếu tồn tại để hint Components Used (cho Dependencies section của test-design)
|
|
95
|
+
|
|
96
|
+
Tóm tắt context:
|
|
97
|
+
|
|
98
|
+
```
|
|
99
|
+
TÔI HIỂU:
|
|
100
|
+
- Feature: {F-XXX} — {slug}
|
|
101
|
+
- Trong frd.md:
|
|
102
|
+
- {N} Flows
|
|
103
|
+
- {M} User Stories ({K} Acceptance Criteria)
|
|
104
|
+
- {P} Verification Rules
|
|
105
|
+
- {Q} Feature Acceptance Criteria
|
|
106
|
+
- test-design.md hiện tại: {chưa có / sẽ overwrite — backup tại test-design.md.bak.{timestamp}}
|
|
107
|
+
- fdd.md: {tồn tại — Components Used: C-XXX, C-YYY / chưa có}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
### Bước 4: Auto-derive draft
|
|
113
|
+
|
|
114
|
+
**Nguyên tắc:** mechanical derive 1:1 từ frd.md — same algorithm như `/spec-test` (xem [skills/spec-test/SKILL.md](../spec-test/SKILL.md) Bước 3.1-3.3). Tóm lại:
|
|
115
|
+
|
|
116
|
+
#### 4.1 ID assignment
|
|
117
|
+
|
|
118
|
+
- IDs bắt đầu từ `001` (vì tạo mới hoặc regenerate). TS và TC cùng feature ID `F{NNN}`, TC dùng chung sequence cho Functional / Validation / E2E / Non-functional / Data & Migration — không đẻ prefix riêng.
|
|
119
|
+
- ID sẽ stable kể từ thời điểm này — lần edit tiếp theo qua `/spec-test` integration phải preserve.
|
|
120
|
+
|
|
121
|
+
#### 4.2 Derivation rules
|
|
122
|
+
|
|
123
|
+
| frd item | test-design output |
|
|
124
|
+
| --- | --- |
|
|
125
|
+
| Mỗi `Flow {N}` trong User Flows | 1 Test Scenario `TS-F{NNN}-{seq}` |
|
|
126
|
+
| Mỗi `AC-F{NNN}-{seq}` trong US | 1 Functional TC `TC-F{NNN}-{seq}` |
|
|
127
|
+
| Mỗi `VR-F{NNN}-{seq}` | 1 positive + 1+ negative Validation TC |
|
|
128
|
+
| Mỗi `FAC-F{NNN}-{seq}` (end-to-end) | 1 E2E TC (Type `E2E — journey`/`consistency`/`integrity`) |
|
|
129
|
+
| Mỗi `NFR-F{NNN}-{seq}` | 1 Non-functional TC (Type `performance`/`a11y`/`security`...) |
|
|
130
|
+
| Mỗi `DM-F{NNN}-{seq}` (section required-emptyable) | 1 Data & Migration TC (Type `data migration`) |
|
|
131
|
+
|
|
132
|
+
Detail dịch G/W/T → Preconditions/Steps/Expected, infer negative VR branches từ rule text — xem `/spec-test` Bước 3.2.
|
|
133
|
+
|
|
134
|
+
#### 4.3 Priority defaults
|
|
135
|
+
|
|
136
|
+
| Source | Priority |
|
|
137
|
+
| --- | --- |
|
|
138
|
+
| TC cover US Must | P0 |
|
|
139
|
+
| TC cover US Should | P1 |
|
|
140
|
+
| TC cover US Could | P2 |
|
|
141
|
+
| TC cover VR | inherit max priority của Refs (P1 default nếu Refs trống) |
|
|
142
|
+
| TC cover FAC e2e (journey) | P0 |
|
|
143
|
+
| TC cover FAC integrity | P0 |
|
|
144
|
+
| TC cover FAC consistency | P1 |
|
|
145
|
+
| TC cover NFR security | P0 |
|
|
146
|
+
| TC cover NFR perf/a11y/i18n/browser | P1 |
|
|
147
|
+
| TC cover DM (data & migration) | P0 |
|
|
148
|
+
|
|
149
|
+
#### 4.4 Traceability Matrix
|
|
150
|
+
|
|
151
|
+
Row per frd item — Flow / US / Story AC / VR / FAC / NFR / DM. Mọi item phải có cover ✅. Item không thể derive → ❌ + ghi lý do ở Gaps section.
|
|
152
|
+
|
|
153
|
+
#### 4.5 Placeholders cần QC fill
|
|
154
|
+
|
|
155
|
+
Agent **không suy đoán**:
|
|
156
|
+
|
|
157
|
+
| Field | Placeholder |
|
|
158
|
+
| --- | --- |
|
|
159
|
+
| Test Data Requirements | Row `{TBD — shape}` cho mỗi dataset test cần (yêu cầu data, không phải nguồn/refresh) |
|
|
160
|
+
| Out of Scope | Để trống với note `<!-- QC fill -->` |
|
|
161
|
+
| Test Strategy > Approach | Bullet generic theo template gốc |
|
|
162
|
+
| Overview | 2-3 câu mô tả feature scope từ frd Overview |
|
|
163
|
+
|
|
164
|
+
#### 4.6 Dependencies section
|
|
165
|
+
|
|
166
|
+
- **FRD reference**: path tới `frd.md` của feature này
|
|
167
|
+
- **Components Used**: copy từ `frd.md > Components Used`. Nếu fdd.md tồn tại → cross-reference C-XXX để đảm bảo đúng.
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
### Bước 5: Review — xác nhận với QC
|
|
172
|
+
|
|
173
|
+
Hiển thị draft đầy đủ — chưa ghi file.
|
|
174
|
+
|
|
175
|
+
> Draft test-design.md trên đã đúng chưa? Check:
|
|
176
|
+
>
|
|
177
|
+
> 1. **Coverage** — Traceability Matrix có đủ row cho mỗi Flow / US / AC / VR / FAC / NFR / DM trong frd?
|
|
178
|
+
> 2. **Priority** — defaults theo bảng 4.3, có TC nào cần override?
|
|
179
|
+
> 3. **Placeholders** — fill Test Data Requirements / Out of Scope / Strategy Approach.
|
|
180
|
+
> 4. **Extra edge cases** — ngoài AC/VR có scenario QC muốn thêm?
|
|
181
|
+
>
|
|
182
|
+
> Confirm để ghi file. Reject để revise.
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
### Bước 6: Save
|
|
187
|
+
|
|
188
|
+
Ghi `.specs/main/feature/{F-XXX}-{slug}/test-design.md` với status `draft` (feature-level artifact có lifecycle riêng, không phải `approved` — QC còn fill placeholders nên status `draft` cho đến khi đầy đủ). Frontmatter lấy `template_version` từ `test-design-template.md` (xem `conventions.md` §7).
|
|
189
|
+
|
|
190
|
+
Nếu overwrite — file backup `test-design.md.bak.{timestamp}` đã tạo ở Bước 2.
|
|
191
|
+
|
|
192
|
+
**Change History:** Append entry vào section `## Change History` cuối test-design.md (theo `conventions.md` §5.5):
|
|
193
|
+
|
|
194
|
+
```markdown
|
|
195
|
+
### {YYYY-MM-DD} — manual — create
|
|
196
|
+
|
|
197
|
+
- **All sections**: initial scaffold qua /spec-test-design (mechanical derive từ frd.md — N TS, M Functional TC, P Validation TC, Q E2E TC, R Non-functional TC, S Data & Migration TC)
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
Nếu overwrite test-design.md cũ → entry vẫn dùng operation `create` (vì IDs regenerate fresh, không phải update), thêm note trong body: `- **Note**: overwrote previous test-design.md (backup tại test-design.md.bak.{timestamp}) — IDs regenerated từ 001`.
|
|
201
|
+
|
|
202
|
+
Thông báo kết quả:
|
|
203
|
+
|
|
204
|
+
```
|
|
205
|
+
✓ .specs/main/feature/{F-XXX}-{slug}/test-design.md đã được tạo (status: draft)
|
|
206
|
+
Coverage: N Flows → N TS, M US/AC → M Functional TC, P VR → ~2P Validation TC, Q FAC → Q E2E TC, R NFR → R Non-functional TC, S DM → S Data & Migration TC
|
|
207
|
+
{nếu overwrite: backup tại test-design.md.bak.{timestamp}}
|
|
208
|
+
|
|
209
|
+
Bước tiếp theo:
|
|
210
|
+
- QC: fill remaining placeholders (Test Data Requirements, Out of Scope, Strategy)
|
|
211
|
+
- Đổi status: draft → approved khi sẵn sàng
|
|
212
|
+
- Sau này: nếu frd thay đổi → dùng /spec-test qua integration changeset để giữ ID stable
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
## Common Rationalizations
|
|
218
|
+
|
|
219
|
+
| Rationalization | Reality |
|
|
220
|
+
| --- | --- |
|
|
221
|
+
| "Có frd rồi, viết test-design sau cũng được" | Test coverage không tracked = không biết feature đóng được chưa. test-design làm song song với frd, không sau. |
|
|
222
|
+
| "Rebuild test-design nhanh hơn cập nhật manual" | Đúng cho lần đầu. Lần sau khi đã có test code reference → rebuild sẽ break references. Lúc đó dùng `/spec-test`. |
|
|
223
|
+
| "Brownfield không cần test-design, đã có test code" | Test code là HOW. test-design là WHAT — declarative TC list để track coverage vs frd. Hai layer khác nhau. |
|
|
224
|
+
|
|
225
|
+
## Red Flags
|
|
226
|
+
|
|
227
|
+
- Traceability Matrix có ❌ mà không có Gaps section giải thích
|
|
228
|
+
- Priority hàng loạt P1 — chưa override theo defaults
|
|
229
|
+
- Test Strategy / Test Data Requirements toàn `TBD` sau khi QC review xong
|
|
230
|
+
- Overwrite test-design.md hiện có mà không cảnh báo về ID break
|
|
231
|
+
|
|
232
|
+
## Verification
|
|
233
|
+
|
|
234
|
+
Trước khi ghi file:
|
|
235
|
+
|
|
236
|
+
- [ ] Mỗi Flow trong frd có 1 TS
|
|
237
|
+
- [ ] Mỗi US AC có TC Functional cover
|
|
238
|
+
- [ ] Mỗi VR có ≥1 positive + ≥1 negative TC
|
|
239
|
+
- [ ] Mỗi FAC có TC E2E cover; mỗi NFR có TC Non-functional; mỗi DM có TC Data & Migration
|
|
240
|
+
- [ ] Priority deterministic theo bảng 4.3
|
|
241
|
+
- [ ] Nếu overwrite: test-design.md.bak.{timestamp} đã được tạo
|
|
242
|
+
- [ ] QC đã confirm draft
|
|
243
|
+
- [ ] Frontmatter có `template_version` copy từ `test-design-template.md`
|