sdtk-spec-kit 0.9.2 → 0.10.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 +1 -1
- package/assets/manifest/toolkit-bundle.manifest.json +200 -25
- package/assets/manifest/toolkit-bundle.sha256.txt +47 -12
- package/assets/toolkit/toolkit/AGENTS.md +1 -1
- package/assets/toolkit/toolkit/SDTK_TOOLKIT.md +7 -3
- package/assets/toolkit/toolkit/runtimes/claude/CLAUDE_TEMPLATE.md +3 -0
- package/assets/toolkit/toolkit/scripts/install-claude-skills.ps1 +28 -0
- package/assets/toolkit/toolkit/scripts/install-codex-skills.ps1 +18 -0
- package/assets/toolkit/toolkit/skills/sdtk-orchestrator/SKILL.md +2 -0
- package/assets/toolkit/toolkit/skills/sdtk-qa/SKILL.md +1 -1
- package/assets/toolkit/toolkit/skills/sdtk-smoke-test-spec/SKILL.md +69 -0
- package/assets/toolkit/toolkit/skills/sdtk-smoke-test-spec/scripts/test_validate_smoke_test.py +58 -0
- package/assets/toolkit/toolkit/skills/sdtk-smoke-test-spec/scripts/validate_smoke_test.py +152 -0
- package/assets/toolkit/toolkit/skills/sdtk-test-case-xlsx/SKILL.md +297 -0
- package/assets/toolkit/toolkit/skills/sdtk-test-case-xlsx/prompts/agent_brief_template.md +59 -0
- package/assets/toolkit/toolkit/skills/sdtk-test-case-xlsx/scripts/check_coverage.py +50 -0
- package/assets/toolkit/toolkit/skills/sdtk-test-case-xlsx/scripts/extract_sources.py +224 -0
- package/assets/toolkit/toolkit/skills/sdtk-test-case-xlsx/scripts/merge_parts.py +78 -0
- package/assets/toolkit/toolkit/skills/sdtk-test-case-xlsx/scripts/render_testcase.py +421 -0
- package/assets/toolkit/toolkit/skills/sdtk-test-case-xlsx/scripts/template_set.py +57 -0
- package/assets/toolkit/toolkit/skills/sdtk-test-case-xlsx/scripts/test_write_results.py +89 -0
- package/assets/toolkit/toolkit/skills/sdtk-test-case-xlsx/scripts/write_results.py +126 -0
- package/assets/toolkit/toolkit/skills/sdtk-xlsx-safe-edit/SKILL.md +146 -0
- package/assets/toolkit/toolkit/skills/sdtk-xlsx-safe-edit/scripts/pictures.py +68 -0
- package/assets/toolkit/toolkit/skills/sdtk-xlsx-safe-edit/scripts/test_pictures.py +55 -0
- package/assets/toolkit/toolkit/skills/sdtk-xlsx-safe-edit/scripts/xlsafe.py +137 -0
- package/assets/toolkit/toolkit/skills/sdtk-xlsx-safe-edit/scripts/xlsx_xml_edit.py +153 -0
- package/assets/toolkit/toolkit/skills/skills.catalog.yaml +76 -0
- package/assets/toolkit/toolkit/skills-claude/orchestrator/SKILL.md +1 -1
- package/assets/toolkit/toolkit/skills-claude/qa/SKILL.md +1 -1
- package/assets/toolkit/toolkit/skills-claude/smoke-test-spec/SKILL.md +66 -0
- package/assets/toolkit/toolkit/skills-claude/test-case-xlsx/SKILL.md +294 -0
- package/assets/toolkit/toolkit/skills-claude/xlsx-safe-edit/SKILL.md +143 -0
- package/assets/toolkit/toolkit/templates/README.md +8 -1
- package/assets/toolkit/toolkit/templates/smoke-test/PROFILE_TEMPLATE.md +36 -0
- package/assets/toolkit/toolkit/templates/smoke-test/vi-default/AUTHORING_RULES.md +32 -0
- package/assets/toolkit/toolkit/templates/smoke-test/vi-default/SMOKE_TEST_TEMPLATE.md +147 -0
- package/assets/toolkit/toolkit/templates/smoke-test/vi-default/TEMPLATE.md +25 -0
- package/assets/toolkit/toolkit/templates/test-case-xlsx/PROFILE_TEMPLATE.md +78 -0
- package/assets/toolkit/toolkit/templates/test-case-xlsx/ja-default/TEMPLATE.md +28 -0
- package/assets/toolkit/toolkit/templates/test-case-xlsx/ja-default/viewpoints/README.md +73 -0
- package/assets/toolkit/toolkit/templates/test-case-xlsx/ja-default/viewpoints/_template.xlsx +0 -0
- package/assets/toolkit/toolkit/templates/test-case-xlsx/ja-default/viewpoints/common/common.xlsx +0 -0
- package/assets/toolkit/toolkit/templates/test-case-xlsx/ja-default/viewpoints/platform/mobile_app.xlsx +0 -0
- package/assets/toolkit/toolkit/templates/test-case-xlsx/ja-default/viewpoints/platform/smartphone_web.xlsx +0 -0
- package/assets/toolkit/toolkit/templates/test-case-xlsx/ja-default/viewpoints/platform/web.xlsx +0 -0
- package/assets/toolkit/toolkit/templates/test-case-xlsx/ja-default/viewpoints/platform/windows_app.xlsx +0 -0
- package/assets/toolkit/toolkit/templates/test-case-xlsx/ja-default//343/203/206/343/202/271/343/203/210/344/273/225/346/247/230/346/233/270/344/275/234/346/210/220/343/203/253/343/203/274/343/203/253.md +514 -0
- package/assets/toolkit/toolkit/templates/test-case-xlsx/ja-default//343/203/206/343/202/271/343/203/210/344/273/225/346/247/230/346/233/270/351/233/233/345/236/213.xlsx +0 -0
- package/package.json +1 -1
- package/src/lib/scope.js +4 -2
package/assets/toolkit/toolkit/skills/sdtk-smoke-test-spec/scripts/test_validate_smoke_test.py
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""validate_smoke_test.py — python -m unittest test_validate_smoke_test (from this folder)."""
|
|
3
|
+
import os
|
|
4
|
+
import sys
|
|
5
|
+
import unittest
|
|
6
|
+
|
|
7
|
+
HERE = os.path.dirname(os.path.abspath(__file__))
|
|
8
|
+
sys.path.insert(0, HERE)
|
|
9
|
+
import validate_smoke_test as v # noqa: E402
|
|
10
|
+
|
|
11
|
+
TEMPLATE_DIR = os.path.normpath(os.path.join(HERE, "..", "..", "..", "templates", "smoke-test", "vi-default"))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def filled_template():
|
|
15
|
+
with open(os.path.join(TEMPLATE_DIR, "SMOKE_TEST_TEMPLATE.md"), encoding="utf-8") as f:
|
|
16
|
+
return f.read().replace("<SUITE>", "DEMO").replace("<mã spec>", "S-1")
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class TemplateAndValidator(unittest.TestCase):
|
|
20
|
+
def setUp(self):
|
|
21
|
+
self.cfg = v.load_config(TEMPLATE_DIR)
|
|
22
|
+
self.text = filled_template()
|
|
23
|
+
|
|
24
|
+
def test_the_template_itself_validates(self):
|
|
25
|
+
r = v.validate(self.text, self.cfg)
|
|
26
|
+
self.assertEqual((r["suite"], r["cases"], r["red"], r["errors"]), ("DEMO", 5, 1, []))
|
|
27
|
+
self.assertTrue(r["warnings"]) # the 〔dev điền〕 note is still there
|
|
28
|
+
|
|
29
|
+
def test_totals_mismatch(self):
|
|
30
|
+
r = v.validate(self.text.replace("| **Tổng** | **5** | **1** |", "| **Tổng** | **6** | **1** |"), self.cfg)
|
|
31
|
+
self.assertIn("section 8 says 6 cases / 1 🔴, section 4 has 5 / 1", r["errors"])
|
|
32
|
+
|
|
33
|
+
def test_duplicate_and_wrong_subsection(self):
|
|
34
|
+
r = v.validate(self.text.replace("**DEMO-UI-01**", "**DEMO-FN-01**"), self.cfg)
|
|
35
|
+
self.assertTrue(any("duplicate ids" in e for e in r["errors"]))
|
|
36
|
+
self.assertTrue(any("is under the UI subsection" in e for e in r["errors"]))
|
|
37
|
+
|
|
38
|
+
def test_escaped_pipe_stays_in_its_cell(self):
|
|
39
|
+
r = v.validate(self.text.replace("<bước>", r"Đặt tên A\|B", 1), self.cfg)
|
|
40
|
+
self.assertEqual(r["errors"], [])
|
|
41
|
+
|
|
42
|
+
def test_old_suite_ids_outside_section_4_are_not_cases(self):
|
|
43
|
+
r = v.validate(self.text.replace("<OLD-FN-01>", "**OLD-FN-01**"), self.cfg)
|
|
44
|
+
self.assertEqual((r["cases"], r["errors"]), (5, []))
|
|
45
|
+
|
|
46
|
+
def test_empty_spec_and_unknown_result(self):
|
|
47
|
+
text = self.text.replace("| <thứ nhìn thấy được> | S-1 | ☐ |", "| <thứ nhìn thấy được> | | XX |", 1)
|
|
48
|
+
r = v.validate(text, self.cfg)
|
|
49
|
+
self.assertTrue(any("empty Spec cell" in e for e in r["errors"]))
|
|
50
|
+
self.assertTrue(any("result 'XX'" in e for e in r["errors"]))
|
|
51
|
+
|
|
52
|
+
def test_missing_section(self):
|
|
53
|
+
r = v.validate(self.text.replace("## 6. Hạn chế", "## Hạn chế"), self.cfg)
|
|
54
|
+
self.assertIn("section '## 6.' missing", r["errors"])
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
if __name__ == "__main__":
|
|
58
|
+
unittest.main()
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""Checks a smoke-test markdown written from the smoke-test template (toolkit/templates/smoke-test/<set>/).
|
|
3
|
+
|
|
4
|
+
python validate_smoke_test.py <SMOKE_TEST_*.md> [--template-dir <set dir>] [--json]
|
|
5
|
+
|
|
6
|
+
Checks (errors fail with exit 1, warnings do not):
|
|
7
|
+
- every required section of the template is there (## 0 … ## 9);
|
|
8
|
+
- case tables (section 4 only) have the template's columns, in order;
|
|
9
|
+
- case ids match <SUITE>-<UI|FN|ER|BV|RG>-<NN>, one suite prefix, no duplicates, and each id sits under the
|
|
10
|
+
subsection of its group;
|
|
11
|
+
- every case has a non-empty Spec cell, a severity from the allowed set and a result cell from the allowed set;
|
|
12
|
+
- the totals row of section 8 equals the counted cases and 🔴 cases;
|
|
13
|
+
- placeholders left for the developer (〔…〕) are counted as warnings.
|
|
14
|
+
Ids outside section 4 (for example the cases of an older suite that this one replaces) are not cases of this suite.
|
|
15
|
+
"""
|
|
16
|
+
import argparse
|
|
17
|
+
import json
|
|
18
|
+
import os
|
|
19
|
+
import re
|
|
20
|
+
import sys
|
|
21
|
+
|
|
22
|
+
DEFAULTS = {
|
|
23
|
+
"required_sections": ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
24
|
+
"case_columns": ["ID", "Mức", "Tiền điều kiện", "Bước thực hiện", "Kết quả mong đợi", "Spec", "KQ", "Ghi chú"],
|
|
25
|
+
"severities": ["🔴", "🟡", ""],
|
|
26
|
+
"results": ["☐", "OK", "NG", "保留", "N/A"],
|
|
27
|
+
"groups": ["UI", "FN", "ER", "BV", "RG"],
|
|
28
|
+
"total_label": "Tổng",
|
|
29
|
+
"placeholder": r"〔[^〕]*〕",
|
|
30
|
+
}
|
|
31
|
+
ID_RE = re.compile(r"^\**([A-Z][A-Z0-9]*(?:-[A-Z0-9]+)*?)-(UI|FN|ER|BV|RG)-(\d+)\**$")
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def load_config(template_dir):
|
|
35
|
+
"""TEMPLATE.md of the template set may carry a ```json validator``` block overriding DEFAULTS."""
|
|
36
|
+
cfg = dict(DEFAULTS)
|
|
37
|
+
if template_dir:
|
|
38
|
+
path = os.path.join(template_dir, "TEMPLATE.md")
|
|
39
|
+
with open(path, encoding="utf-8") as f:
|
|
40
|
+
m = re.search(r"```json validator\s*\n(.*?)```", f.read(), re.S)
|
|
41
|
+
if m:
|
|
42
|
+
cfg.update(json.loads(m.group(1)))
|
|
43
|
+
return cfg
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def split_sections(text):
|
|
47
|
+
"""{'0': body, '1': body, …} for the '## <n>.' headings (appendices and other headings kept under their own title)."""
|
|
48
|
+
parts = re.split(r"^## ", text, flags=re.M)
|
|
49
|
+
out = {}
|
|
50
|
+
for p in parts[1:]:
|
|
51
|
+
title = p.split("\n", 1)[0]
|
|
52
|
+
m = re.match(r"(\d+)[.\s]", title)
|
|
53
|
+
out[m.group(1) if m else title.strip()] = p
|
|
54
|
+
return out
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def cells_of(line):
|
|
58
|
+
"""Cells of a markdown table row; an escaped pipe (backslash + pipe) inside a cell is text, not a separator."""
|
|
59
|
+
return [c.strip().replace("\\|", "|") for c in re.split(r"(?<!\\)\|", line.strip().strip("|"))]
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def table_rows(block):
|
|
63
|
+
"""Markdown table rows of a block as lists of stripped cells (header and separator included)."""
|
|
64
|
+
rows = []
|
|
65
|
+
for line in block.splitlines():
|
|
66
|
+
if line.startswith("|"):
|
|
67
|
+
rows.append(cells_of(line))
|
|
68
|
+
return rows
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def validate(text, cfg=DEFAULTS):
|
|
72
|
+
errors, warnings = [], []
|
|
73
|
+
sections = split_sections(text)
|
|
74
|
+
for s in cfg["required_sections"]:
|
|
75
|
+
if s not in sections:
|
|
76
|
+
errors.append(f"section '## {s}.' missing")
|
|
77
|
+
body4 = sections.get("4", "")
|
|
78
|
+
cases, suites, group_of_sub = [], set(), None
|
|
79
|
+
for line in body4.splitlines():
|
|
80
|
+
sub = re.match(r"^#{3,4} .*?—\s*[A-Z0-9-]*-(UI|FN|ER|BV|RG)\b", line)
|
|
81
|
+
if sub:
|
|
82
|
+
group_of_sub = sub.group(1)
|
|
83
|
+
if not line.startswith("|"):
|
|
84
|
+
continue
|
|
85
|
+
cells = cells_of(line)
|
|
86
|
+
if cells[:1] == ["ID"]:
|
|
87
|
+
if cells != cfg["case_columns"]:
|
|
88
|
+
errors.append(f"case table columns {cells} differ from the template {cfg['case_columns']}")
|
|
89
|
+
continue
|
|
90
|
+
m = ID_RE.match(cells[0]) if cells else None
|
|
91
|
+
if not m:
|
|
92
|
+
continue
|
|
93
|
+
case_id = f"{m.group(1)}-{m.group(2)}-{m.group(3)}"
|
|
94
|
+
suites.add(m.group(1))
|
|
95
|
+
if group_of_sub and m.group(2) != group_of_sub:
|
|
96
|
+
errors.append(f"{case_id} is under the {group_of_sub} subsection")
|
|
97
|
+
if len(cells) != len(cfg["case_columns"]):
|
|
98
|
+
errors.append(f"{case_id}: {len(cells)} cells, expected {len(cfg['case_columns'])}")
|
|
99
|
+
continue
|
|
100
|
+
row = dict(zip(cfg["case_columns"], cells))
|
|
101
|
+
sev, spec, result = cells[1], row.get("Spec", cells[5]), cells[6]
|
|
102
|
+
if sev not in cfg["severities"]:
|
|
103
|
+
errors.append(f"{case_id}: severity {sev!r} not in {cfg['severities']}")
|
|
104
|
+
if not spec:
|
|
105
|
+
errors.append(f"{case_id}: empty Spec cell")
|
|
106
|
+
if result not in cfg["results"]:
|
|
107
|
+
errors.append(f"{case_id}: result {result!r} not in {cfg['results']}")
|
|
108
|
+
cases.append({"id": case_id, "red": sev == "🔴"})
|
|
109
|
+
ids = [c["id"] for c in cases]
|
|
110
|
+
dups = sorted({i for i in ids if ids.count(i) > 1})
|
|
111
|
+
if dups:
|
|
112
|
+
errors.append(f"duplicate ids: {dups}")
|
|
113
|
+
if len(suites) > 1:
|
|
114
|
+
errors.append(f"several suite prefixes in section 4: {sorted(suites)}")
|
|
115
|
+
if not cases:
|
|
116
|
+
errors.append("no case rows found in section 4")
|
|
117
|
+
total, red = len(cases), sum(c["red"] for c in cases)
|
|
118
|
+
totals = [r for r in table_rows(sections.get("8", "")) if r and r[0].strip("* ") == cfg["total_label"]]
|
|
119
|
+
if not totals:
|
|
120
|
+
errors.append(f"section 8 has no '{cfg['total_label']}' row")
|
|
121
|
+
else:
|
|
122
|
+
nums = [re.sub(r"\D", "", c) for c in totals[0][1:3]]
|
|
123
|
+
if nums != [str(total), str(red)]:
|
|
124
|
+
errors.append(f"section 8 says {nums[0]} cases / {nums[1]} 🔴, section 4 has {total} / {red}")
|
|
125
|
+
placeholders = re.findall(cfg["placeholder"], text)
|
|
126
|
+
if placeholders:
|
|
127
|
+
warnings.append(f"{len(placeholders)} placeholder(s) left for the developer, e.g. {placeholders[0]}")
|
|
128
|
+
return {"suite": next(iter(suites), None), "cases": total, "red": red, "errors": errors, "warnings": warnings}
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
def main(argv=None):
|
|
132
|
+
sys.stdout.reconfigure(encoding="utf-8")
|
|
133
|
+
a = argparse.ArgumentParser()
|
|
134
|
+
a.add_argument("file")
|
|
135
|
+
a.add_argument("--template-dir")
|
|
136
|
+
a.add_argument("--json", action="store_true")
|
|
137
|
+
args = a.parse_args(argv)
|
|
138
|
+
with open(args.file, encoding="utf-8") as f:
|
|
139
|
+
result = validate(f.read(), load_config(args.template_dir))
|
|
140
|
+
if args.json:
|
|
141
|
+
print(json.dumps(result, ensure_ascii=False, indent=1))
|
|
142
|
+
else:
|
|
143
|
+
print(f"{os.path.basename(args.file)}: suite {result['suite']}, {result['cases']} cases, {result['red']} 🔴")
|
|
144
|
+
for e in result["errors"]:
|
|
145
|
+
print(" ERROR", e)
|
|
146
|
+
for w in result["warnings"]:
|
|
147
|
+
print(" WARN ", w)
|
|
148
|
+
return 1 if result["errors"] else 0
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
if __name__ == "__main__":
|
|
152
|
+
sys.exit(main())
|
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sdtk-test-case-xlsx
|
|
3
|
+
description: Use when test cases / テストケース / テスト仕様書 must be an Excel workbook from a customer's template: create or update them, convert existing smoke-test / test-case markdown into one, or write executed results (OK / NG / 保留) back. Selected by orchestration.testCaseSpecMode = xlsx; the markdown form is sdtk-test-case-spec.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# SDTK-SPEC Test Case Spec (Excel workbook)
|
|
7
|
+
|
|
8
|
+
Three parts, kept apart so each customer can have its own format:
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
toolkit/skills/sdtk-test-case-xlsx/ (core — workflow and scripts, no project or customer content)
|
|
12
|
+
SKILL.md, prompts/agent_brief_template.md
|
|
13
|
+
scripts/template_set.py <- finds the template set (below)
|
|
14
|
+
scripts/extract_sources.py <- collect the viewpoints of each output sheet + dump the output template
|
|
15
|
+
scripts/merge_parts.py <- merge sub-agent part_*.json files into spec.json
|
|
16
|
+
scripts/render_testcase.py <- validate the JSON + render .md (+ --xlsx)
|
|
17
|
+
scripts/check_coverage.py <- check that every existing test-case ID was converted
|
|
18
|
+
scripts/write_results.py <- write executed results into the workbook (XML route, nothing else changes)
|
|
19
|
+
|
|
20
|
+
toolkit/templates/test-case-xlsx/<set>/ (template set — replaceable per customer; default ja-default)
|
|
21
|
+
TEMPLATE.md <- manifest + ```json config``` (output template, columns of the results)
|
|
22
|
+
テスト仕様書作成ルール.md <- MANDATORY authoring rules (§1–§11) of this set
|
|
23
|
+
テスト仕様書雛型.xlsx <- output template
|
|
24
|
+
viewpoints/common | platform/<platform>.xlsx | customer/<customer>/ <- test viewpoints, see viewpoints/README.md
|
|
25
|
+
toolkit/templates/test-case-xlsx/PROFILE_TEMPLATE.md <- template for a new project profile
|
|
26
|
+
|
|
27
|
+
<project repo>/…/testcase_profile.md (project — sources, sheets, conventions, test data)
|
|
28
|
+
<project repo>/…/testcase_profile.base.json (project — "template_set", cover, viewpoints selection, sheets, db_prefixes)
|
|
29
|
+
<project repo>/docs/templates/test-case-xlsx/<customer>/ (optional — a customer's own template set; wins over the toolkit's)
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Template set resolution (`scripts/template_set.py`): `--template-dir` / base.json `"template_set"` (name or path) →
|
|
33
|
+
`docs/templates/test-case-xlsx/<name>/` in the project → `toolkit/templates/test-case-xlsx/<name>/` → `$SDTK_TEMPLATES_DIR`.
|
|
34
|
+
A customer's own format = copy `ja-default` into the project, change the workbook / rules / viewpoints, set its name.
|
|
35
|
+
|
|
36
|
+
You **never write the markdown or Excel tables by hand**: write the test cases as JSON (green columns only);
|
|
37
|
+
the scripts sort by band / minor category, number the rows, fill 中分類, run the §11 self-check and render.
|
|
38
|
+
Run every command from the **repo root**; use `python` (Windows) or `python3` (Linux/macOS).
|
|
39
|
+
`S=toolkit/skills/sdtk-test-case-xlsx`; `T` = the resolved template set folder (printed by extract_sources.py).
|
|
40
|
+
`W` = a temporary working directory (the session scratchpad) for part_*.json, the brief and generator scripts —
|
|
41
|
+
never committed. `P` = the directory holding the project profile.
|
|
42
|
+
|
|
43
|
+
Terminology: 観点 (kanten) = test viewpoint; 大分類 / 中分類 / 小分類 = major / middle / minor category;
|
|
44
|
+
帯 = band (§4-B of the rules); 正常系 / 異常系 / 境界値 = normal / abnormal / boundary.
|
|
45
|
+
|
|
46
|
+
<!-- neutral-only -->
|
|
47
|
+
> **Installed as a runtime skill** (for example under `.codex/skills/`): read `toolkit/skills/sdtk-<name>/` in the
|
|
48
|
+
> paths below as the installed skill folder of that name (this one or a sibling) and `toolkit/templates/` as
|
|
49
|
+
> `references/templates/` inside this skill's folder.
|
|
50
|
+
<!-- /neutral-only -->
|
|
51
|
+
|
|
52
|
+
## Critical Constraints
|
|
53
|
+
|
|
54
|
+
1. **Never guess.** Scope, output location, column-H check locations and authoritative test files come from the
|
|
55
|
+
project profile or the person; open / unconfirmed spec points become report items §11-3 / §11-4, not cases.
|
|
56
|
+
2. **Never write the markdown or Excel tables by hand** and never edit the rendered `.md` / `.xlsx`: edit the JSON and
|
|
57
|
+
render again. `render_testcase.py` must exit 0.
|
|
58
|
+
3. **Every existing case is converted** (original ID kept in column E) and checked with `check_coverage.py`.
|
|
59
|
+
4. **Never save a workbook with openpyxl.** Results go in with `write_results.py` (XML route of sdtk-xlsx-safe-edit)
|
|
60
|
+
into the tester's latest copy only.
|
|
61
|
+
5. **Cases are identified by sheet + No**, never by position; delivered cases are never renumbered.
|
|
62
|
+
6. **The template set's rules file is mandatory** (`テスト仕様書作成ルール.md`); this skill only adds to it.
|
|
63
|
+
|
|
64
|
+
## Process
|
|
65
|
+
|
|
66
|
+
0. Locate (or create) the project profile.
|
|
67
|
+
1. Read the spec sources in full.
|
|
68
|
+
2. Read the existing test cases the profile lists.
|
|
69
|
+
3. Read the viewpoints, rules and template (`extract_sources.py`).
|
|
70
|
+
4. Write the JSON source (split across sub-agents when large).
|
|
71
|
+
5. Validate and render (`render_testcase.py`, `check_coverage.py`).
|
|
72
|
+
6. Report to the person (§11).
|
|
73
|
+
7. Later rounds: write executed results into the workbook (`write_results.py`).
|
|
74
|
+
|
|
75
|
+
The steps in detail:
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## Step 0 — Locate the project profile
|
|
80
|
+
|
|
81
|
+
Search the repo for `testcase_profile.md` (Glob `**/testcase_profile.md`). If found, read it in full; every
|
|
82
|
+
project-specific decision comes from it. If the user names a profile path, use that.
|
|
83
|
+
|
|
84
|
+
If none exists: copy `toolkit/templates/test-case-xlsx/PROFILE_TEMPLATE.md` to `<dir>/testcase_profile.md` (ask the user for `<dir>`; suggest the
|
|
85
|
+
folder where the test specification will be written) and create `<dir>/testcase_profile.base.json`. Fill each section
|
|
86
|
+
by reading the project's docs. Anything that cannot be derived from the docs (scope, output location, how results are
|
|
87
|
+
checked in column H, which existing test files are authoritative …) → **ask the user before writing any case**; never guess.
|
|
88
|
+
|
|
89
|
+
If the output already exists (`<output>.spec.json` in the profile) and the user only asks for an update: edit that
|
|
90
|
+
spec.json directly (add / remove / change cases for the changed spec or source test cases), then run Step 5 again.
|
|
91
|
+
Do not regenerate from scratch.
|
|
92
|
+
|
|
93
|
+
## Step 1 — Read the spec sources (mandatory, in full)
|
|
94
|
+
|
|
95
|
+
Read every file listed under **Spec sources** in the profile (files > 25k tokens: read with `offset`/`limit`).
|
|
96
|
+
Always take the latest decision; ignore struck-through or "replaced by" content. Open / unconfirmed points → do not
|
|
97
|
+
write cases based on guesses; record them in report items §11-3 / §11-4.
|
|
98
|
+
|
|
99
|
+
## Step 2 — Read the existing test cases (when the profile lists them)
|
|
100
|
+
|
|
101
|
+
The profile section **Existing test cases** lists existing test-case / smoke-test files and their target sheets.
|
|
102
|
+
They are a **mandatory source**: the team has already verified them against the real system.
|
|
103
|
+
|
|
104
|
+
- Every existing case → at least one case in the spec. Keep its original ID in column E, in the profile's format
|
|
105
|
+
(e.g. `REQ-7 / SCR-02 / SYNC-NF-01`), so it can be traced both ways.
|
|
106
|
+
- Keep the meaning of the operation and the expected result; rewrite them to the rules (§4-F numbered steps with
|
|
107
|
+
concrete values; §4-G verifiable results) and write them in Japanese (main) + Vietnamese.
|
|
108
|
+
- An existing case that the rules require to be split (one row checking things of different 大分類) → several cases
|
|
109
|
+
with the same original ID plus a suffix `-a`, `-b`.
|
|
110
|
+
- **Never** write a case that contradicts the source file's "known limitations / not a bug" section. Cases in an
|
|
111
|
+
"already covered by automated tests" section → follow the profile (default: leave them out, list them in §11-3).
|
|
112
|
+
- An existing case that contradicts the latest spec → follow the latest spec, record it in §11-4 (with the original ID).
|
|
113
|
+
- Rule §7.2 (use only viewpoints of the reference viewpoint set) restricts **adding cases from viewpoints**, not existing
|
|
114
|
+
cases — existing cases are always included.
|
|
115
|
+
- Two existing cases with the same content → merge into one case; column E lists both original IDs.
|
|
116
|
+
- An existing case that is not an operation of the system (only an environment check or tool preparation) → turn it
|
|
117
|
+
into `data_prep`, put its ID into `--exclude` of the coverage check, and record it in §11-3.
|
|
118
|
+
- A result that is neither on the screen nor in a column-H check location (e.g. a process exit code) → write it in
|
|
119
|
+
column G as an observable fact (e.g. 「PowerShell に `2` が表示される」).
|
|
120
|
+
- The source defines no message wording → column G states the observable result (dialog title, resulting screen
|
|
121
|
+
state); never invent wording; record it in §11-3.
|
|
122
|
+
- **The spec and the existing cases define the expected results.** Reading the code is allowed to get table/column
|
|
123
|
+
names and to detect differences; if the code differs from the spec, still write to the spec and record it in §11-4
|
|
124
|
+
(name the code file and quote both wordings).
|
|
125
|
+
|
|
126
|
+
## Step 3 — Read the viewpoints, rules and template
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
python $S/scripts/extract_sources.py $P/testcase_profile.base.json $W/src
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Using `viewpoints` (platforms, customer, customer_tags) and each sheet's `screen_types` from the base JSON, this writes
|
|
133
|
+
`$W/src/viewpoints/<output sheet>.tsv` — the **reference viewpoint set** of that sheet (rules §7.2), customer rows
|
|
134
|
+
first, then platform, then common; the first column names the source. Also `_index.tsv` (every viewpoint sheet found
|
|
135
|
+
and whether it was used), `_meta.txt` (non-viewpoint sheets such as the customer's rules / open questions — read them)
|
|
136
|
+
and `$W/src/template.txt`. Read `$T/テスト仕様書作成ルール.md` (the rules file of the template set) **in full** — the rules are mandatory; this SKILL.md
|
|
137
|
+
and the profile only add to them, never replace them. Check the WARN lines (screen type without viewpoints, customer
|
|
138
|
+
sheet not used by any output sheet) before going on.
|
|
139
|
+
|
|
140
|
+
For each output sheet, go through **every row** of its `.tsv`:
|
|
141
|
+
- Same check in several layers → use the most specific row only (customer > platform > common).
|
|
142
|
+
- Viewpoint already covered by an existing case → do not duplicate.
|
|
143
|
+
- Viewpoint applicable but not yet covered → create a new case (column E has the spec / screen ID, no original ID).
|
|
144
|
+
- Viewpoint not applicable (control does not exist, the 備考 condition 「〜のみ」 is not met) → skip.
|
|
145
|
+
- Viewpoint under §7.1 (px / #RRGGBB / font, hover, 過去障害あり …) → must become a case, or be reported as
|
|
146
|
+
"mandatory viewpoint not implemented" (未実施の必須観点).
|
|
147
|
+
|
|
148
|
+
## Step 4 — Write the JSON source
|
|
149
|
+
|
|
150
|
+
`$W/spec.json` = `$P/testcase_profile.base.json` (cover, sheets, db_prefixes, common report_notes) + cases.
|
|
151
|
+
|
|
152
|
+
```json
|
|
153
|
+
{
|
|
154
|
+
"cover": {"system_name": {"ja": "…", "vi": "…"}, "subsystem_name": {…}, "function_name": {…}, "related_specs": {…}},
|
|
155
|
+
"extra_majors": [],
|
|
156
|
+
"db_prefixes": ["[DB]", "[API]"],
|
|
157
|
+
"viewpoints": {"platforms": ["web"], "customer": "<folder under viewpoints/customer> or null", "customer_tags": ["PC"]},
|
|
158
|
+
"data_prep": [
|
|
159
|
+
{"target_screen": "共通", "category": {"ja","vi"}, "target": {"ja","vi"}, "state": {"ja","vi"}, "count": {"ja","vi"}, "method": {"ja","vi"}}
|
|
160
|
+
],
|
|
161
|
+
"sheets": [
|
|
162
|
+
{"name": "01_ログイン画面", "screen_name": "ログイン画面", "screen_name_vi": "Màn hình đăng nhập",
|
|
163
|
+
"screen_types": ["登録・編集画面", "ダイアログ"],
|
|
164
|
+
"cases": [
|
|
165
|
+
{"major": "登録", "minor": "正常系", "spec": "REQ-1 / SCR-01 / LOGIN-NL-01",
|
|
166
|
+
"steps": {"ja": ["…", "…"], "vi": ["…", "…"]},
|
|
167
|
+
"screen": {"ja": "…", "vi": "…"},
|
|
168
|
+
"db": {"ja": "[DB] users.last_login_dt = 実行日時", "vi": "…"}}
|
|
169
|
+
]}
|
|
170
|
+
],
|
|
171
|
+
"report": [{"title_ja": "3. …", "title_vi": "…", "items": [{"ja": "…", "vi": "…"}]}]
|
|
172
|
+
}
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
- `screen_types` (per sheet) and `viewpoints` (per project) select the reference viewpoint set (§7.2); they come from
|
|
176
|
+
the base JSON — change them there, not in spec.json only.
|
|
177
|
+
- `major` ∈ the 大分類 of §4-B (or `extra_majors: [{"ja","vi","band"}]` — placed at the end of that band; must be
|
|
178
|
+
reported in §11-5). `minor` ∈ `正常系 / 異常系 / 境界値`.
|
|
179
|
+
- `steps.*` are lists of strings, **not** numbered by you. A case-specific precondition → step 1; shared
|
|
180
|
+
preconditions → `data_prep`.
|
|
181
|
+
- No check needed in column H → `db.ja` is exactly `-(画面表示のみのため確認不要)` and `db.vi` is `""`.
|
|
182
|
+
If the profile defines `db_prefixes`, every line of `db.ja` must start with one prefix (one line = one check location).
|
|
183
|
+
- `report` = all 10 items of §11 (merge_parts.py builds it from `report_notes`). Every note starts with
|
|
184
|
+
「<sheet name>:」 or 「全シート:」 so reviewers know which sheet it belongs to.
|
|
185
|
+
- Bilingual: `ja` is the main text, `vi` has the same meaning and the same number of steps. Never translate: UI labels
|
|
186
|
+
in 「」, table/column names, spec / case IDs, messages, input values. Input values must be concrete (§4-F).
|
|
187
|
+
|
|
188
|
+
**Split across sub-agents** when the total is large (> ~150 cases): follow the profile's **Work split** table, one
|
|
189
|
+
part per agent, run in parallel (Agent tool, `general-purpose`, background):
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
sed "s#<W>#$W#g; s#<S>#$S#g; s#<T>#$T#g; s#<PROFILE>#$P/testcase_profile.md#g" $S/prompts/agent_brief_template.md > $W/AGENT_BRIEF.md
|
|
193
|
+
cp $P/testcase_profile.base.json $W/base.json
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
Prompt for each agent: "read `$W/AGENT_BRIEF.md`, do part <N>: <scope from the profile>, write `$W/part_<N>.json`".
|
|
197
|
+
Each part: `{"sheet", "cases", "data_prep", "report_notes": [{"item": 3..10, "ja", "vi"}]}`
|
|
198
|
+
(several sheets: `{"parts": [...]}`). Merge:
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
python $S/scripts/merge_parts.py $W/base.json $W/spec.json $W/part_*.json
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
## Step 5 — Validate and render
|
|
205
|
+
|
|
206
|
+
```bash
|
|
207
|
+
python $S/scripts/render_testcase.py $W/spec.json --check-only
|
|
208
|
+
python $S/scripts/render_testcase.py $W/spec.json --md <output>.md --xlsx <output>.xlsx
|
|
209
|
+
cp $W/spec.json <output>.spec.json # source for later in-place updates
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
The script prints case counts per sheet × 大分類 × 小分類 and exits non-zero on any `ERROR`: valid 大分類 / 小分類,
|
|
213
|
+
columns E/F/G/H not empty, column H uses the exact "no check" string or a valid prefix, same number of JA / VI steps,
|
|
214
|
+
banned vague phrases (`正しく` / `適切に` / `問題なく` / `任意の文字列` / `仕様どおり` … — text inside 「」 is ignored
|
|
215
|
+
because it is verbatim UI text), sheet names (`NN_画面名`, ≤ 31 characters), `data_prep.target_screen`.
|
|
216
|
+
A `WARN` about missing 異常系 / 境界値 → re-check, never ignore.
|
|
217
|
+
|
|
218
|
+
Check yourself (the script cannot): every existing case was converted — run the coverage command from the profile
|
|
219
|
+
(`scripts/check_coverage.py`); content matches the latest spec; G / H are concrete; no undefined numeric values
|
|
220
|
+
were guessed (§7.3); data_prep matches the steps.
|
|
221
|
+
|
|
222
|
+
## Step 6 — Report to the user
|
|
223
|
+
|
|
224
|
+
Per §11: cases per sheet (大分類 × 小分類 — copy from the script output), number of data_prep items, existing
|
|
225
|
+
cases converted / total, then items 3–10. For an update: state which cases were added / removed / changed and why.
|
|
226
|
+
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
## Step 7 — Write executed results into the workbook
|
|
230
|
+
|
|
231
|
+
```
|
|
232
|
+
python $S/scripts/write_results.py <workbook.xlsx> "<sheet>" $W/results.json [--template-dir $T]
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
`results.json` = `{"tester", "date": "YYYY-MM-DD", "cases": {"<No>": {"result", "note", "shots", "reviewer", "reviewer_comment"}}}`.
|
|
236
|
+
Columns and labels come from the template set. Only that sheet's XML part changes (pictures, styles and other sheets
|
|
237
|
+
stay byte-identical); a `要目視` result or an unknown case No stops the write. Never save the workbook with openpyxl.
|
|
238
|
+
**REQUIRED BACKGROUND:** sdtk-xlsx-safe-edit (preflight, backup, "check" = read-only).
|
|
239
|
+
|
|
240
|
+
Before writing into a workbook a tester also maintains: confirm it is their latest copy (modified time, row count,
|
|
241
|
+
the case No column), read their comments in it, and keep cases marked for deletion as they are (status `delete`)
|
|
242
|
+
unless the person says to remove them.
|
|
243
|
+
|
|
244
|
+
## Case identity
|
|
245
|
+
|
|
246
|
+
A case is identified by its sheet + No (column A) for the whole life of the workbook. Matching cases between the
|
|
247
|
+
workbook, spec.json, the markdown and any results file is done **by that id, never by position**: after a row is
|
|
248
|
+
deleted or the sheet renumbered, positional matching silently pairs the wrong cases. Do not renumber delivered cases;
|
|
249
|
+
append new ones and mark removed ones.
|
|
250
|
+
`render_testcase.py` numbers the cases from 1 on every render. Once a workbook is delivered, do not re-render it
|
|
251
|
+
after a deletion: change the tester's workbook only through `write_results.py` / the XML route, keep spec.json in
|
|
252
|
+
step, and tell the person that a re-rendered `.md` would carry different numbers than the workbook.
|
|
253
|
+
|
|
254
|
+
## 対象外 / 未実施 analysis
|
|
255
|
+
|
|
256
|
+
When cases end as 対象外 (not applicable) or 未実施 (not run), classify each before proposing anything:
|
|
257
|
+
(a) the precondition cannot be set up in the real environment → describe another way to set it up (on the PC,
|
|
258
|
+
through the API, by a database change with the SQL attached) or propose dropping the case; (b) the expected result
|
|
259
|
+
does not match the product's real behaviour → propose the corrected expectation with evidence; (c) the spec is not
|
|
260
|
+
decided → raise it as an open question. An NG verdict names the expected item that failed.
|
|
261
|
+
|
|
262
|
+
---
|
|
263
|
+
|
|
264
|
+
## Adding viewpoints (customer files, new platforms)
|
|
265
|
+
|
|
266
|
+
See `$T/viewpoints/README.md`. In short: drop a customer's files into `viewpoints/customer/<name>/` of the project's copy of the template set, unchanged, run
|
|
267
|
+
`python $S/scripts/extract_sources.py --list` to check that every sheet was recognized (screen type + tag), add
|
|
268
|
+
`sheet_map.tsv` only if one was not, then set `viewpoints.customer` / `customer_tags` in the project's base JSON.
|
|
269
|
+
A new platform is a new `viewpoints/platform/<name>.xlsx` (start from `viewpoints/_template.xlsx`). Common and
|
|
270
|
+
platform files must stay project-independent (no product / customer names, no design values of a specific system).
|
|
271
|
+
|
|
272
|
+
## Gotchas
|
|
273
|
+
|
|
274
|
+
- **report_notes end up in a document delivered to the customer / QA** → never mention "brief", "part" or "agent";
|
|
275
|
+
`merge_parts.py` warns when it sees those words.
|
|
276
|
+
- **A sub-agent stopped midway** (usage limit): do NOT spawn a new one from scratch — resume the same agent with
|
|
277
|
+
`SendMessage`. Have agents generate their JSON with a script `$W/gen_part<N>.py` so finished work is not lost.
|
|
278
|
+
- **Never edit the output `.md` / `.xlsx` by hand** — edit spec.json and render again.
|
|
279
|
+
- Output `.xlsx`: columns I–M, columns H–I of テストデータ準備 and the yellow cells of 表紙 stay empty for the testers (§6, §10).
|
|
280
|
+
- `|` inside a markdown cell is escaped by the script; a line break inside a cell becomes `<br>`. View with a Markdown preview.
|
|
281
|
+
- Windows: the cp1252 console cannot print Japanese → all scripts call `reconfigure(utf-8)`; any script you write
|
|
282
|
+
must do the same and open files with `encoding="utf-8"`.
|
|
283
|
+
- Never put real credentials, server URLs, IP addresses or personal e-mail addresses into the spec; use the
|
|
284
|
+
placeholder test data defined in the profile.
|
|
285
|
+
|
|
286
|
+
## Troubleshooting
|
|
287
|
+
|
|
288
|
+
| Symptom | Fix |
|
|
289
|
+
|---|---|
|
|
290
|
+
| `ERROR … db.vi is empty` | Fill `db.vi`, unless `db.ja` is exactly `-(画面表示のみのため確認不要)` |
|
|
291
|
+
| `ERROR … 期待結果(DB) must be '-(画面表示のみのため確認不要)'` | You wrote `-` / `-` / `なし` — replace with the full string |
|
|
292
|
+
| `ERROR … 期待結果(DB) line '…' must start with one of […]` | Add a check-location prefix (profile `db_prefixes`) at the start of every line |
|
|
293
|
+
| `ERROR … banned vague phrase '正しく'` | Rewrite as a verifiable result (concrete label, value, position) |
|
|
294
|
+
| `ERROR … steps.ja and steps.vi have different number of steps` | The VI version must have the same number of steps as JA |
|
|
295
|
+
| `ERROR data_prep target_screen …` | Use `共通` or an exact sheet name |
|
|
296
|
+
| `UnicodeEncodeError: 'charmap'` | In your own script: `sys.stdout.reconfigure(encoding="utf-8")`, open files with `encoding="utf-8"` |
|
|
297
|
+
| Read tool says "exceeds maximum allowed tokens" | Continue with `offset` / `limit`, ~200–250 lines per read |
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Common brief for sub-agents — writing a bilingual テスト仕様書 (JA main + VI)
|
|
2
|
+
|
|
3
|
+
Repo root: the current directory. Work dir: `W=<W>`. Project profile: `<PROFILE>`.
|
|
4
|
+
Skill: `S=<S>`. Template set: `T=<T>`.
|
|
5
|
+
|
|
6
|
+
## Read before writing (in full, no skimming)
|
|
7
|
+
1. `$S/SKILL.md` — especially Step 2 (converting existing cases), Step 3 (going through the viewpoints),
|
|
8
|
+
Step 4 (JSON format).
|
|
9
|
+
2. `$T/テスト仕様書作成ルール.md` — mandatory rules (§4 how to write each column, §7 control checklist, §7.1 mandatory
|
|
10
|
+
viewpoints, §7.2 use only the reference viewpoint set, §7.3 never invent numeric values, §9 viewpoints per
|
|
11
|
+
大分類, §10 prohibitions).
|
|
12
|
+
3. `<PROFILE>` — in full: spec sources, existing test cases, sheets, 大分類 mapping, column E/H conventions,
|
|
13
|
+
standard test data, gotchas.
|
|
14
|
+
4. The spec sources and the **existing test-case files** that the profile assigns to your part — in full.
|
|
15
|
+
5. The reference viewpoint set of your sheet(s): `$W/src/viewpoints/<sheet name>.tsv` (customer rows first, then platform,
|
|
16
|
+
then common — when the same check appears in several layers use only the most specific row), and `$W/src/viewpoints/_meta.txt`.
|
|
17
|
+
|
|
18
|
+
## Order of work
|
|
19
|
+
1. List every existing case ID of your part → convert all of them (original ID in column E).
|
|
20
|
+
2. Go through every row of the reference viewpoint set → add cases for viewpoints not yet covered.
|
|
21
|
+
3. Write `data_prep` for data/states your cases need that the profile's 共通 data does not provide.
|
|
22
|
+
4. Write `report_notes` for guesses, contradictions and skipped viewpoints (items 3–10 of §11).
|
|
23
|
+
|
|
24
|
+
## Output format — write the JSON file `$W/part_<N>.json`
|
|
25
|
+
```json
|
|
26
|
+
{"sheet": "<sheet name exactly as in the profile>",
|
|
27
|
+
"cases": [ {"major": "登録", "minor": "正常系", "spec": "<column E format of the profile>",
|
|
28
|
+
"steps": {"ja": ["…", "…"], "vi": ["…", "…"]},
|
|
29
|
+
"screen": {"ja": "…", "vi": "…"},
|
|
30
|
+
"db": {"ja": "<column H convention of the profile>", "vi": "…"}} ],
|
|
31
|
+
"data_prep": [ {"target_screen": "<sheet name or 共通>", "category": {"ja":"…","vi":"…"}, "target": {"ja":"…","vi":"…"},
|
|
32
|
+
"state": {"ja":"…","vi":"…"}, "count": {"ja":"…","vi":"…"}, "method": {"ja":"…","vi":"…"}} ],
|
|
33
|
+
"report_notes": [ {"item": 3, "ja": "<sheet name>:…(該当ケースの要旨つき)", "vi": "…"} ]}
|
|
34
|
+
```
|
|
35
|
+
Several sheets: `{"parts": [ {sheet, cases, data_prep, report_notes}, ... ]}`.
|
|
36
|
+
|
|
37
|
+
## Writing rules (summary — the rules file wins on any conflict)
|
|
38
|
+
- `major` only from the 大分類 of §4-B (as mapped by the profile). `minor` only: 正常系 / 異常系 / 境界値.
|
|
39
|
+
- `steps` = list of strings, NOT numbered; detailed enough for someone else to follow; concrete input values.
|
|
40
|
+
A case-specific precondition → step 1.
|
|
41
|
+
- `screen` (column G): concrete — labels, positions, enabled/disabled state, verbatim messages, destination screen.
|
|
42
|
+
Forbidden: 「正しく」「適切に」「問題なく」「仕様どおり」「任意の文字列」「適当な値」 (outside verbatim UI text in 「」).
|
|
43
|
+
- `db` (column H): per the profile's convention. Nothing to check → exactly `-(画面表示のみのため確認不要)` with `vi` = "".
|
|
44
|
+
- Use only the profile's standard test data (user names, files, folders …); never invent other names.
|
|
45
|
+
- §7.3: never set a length / count / time limit that is not in the spec or an existing case.
|
|
46
|
+
- Vietnamese text: same meaning, same number of steps; keep 「UI labels」, table/column names, IDs, messages and
|
|
47
|
+
input values untranslated.
|
|
48
|
+
- report_notes are read by spec reviewers: cite documents / IDs; NEVER mention "brief", "part" or "agent".
|
|
49
|
+
Items: 3 = guesses / unclear points; 4 = contradictions or gaps in the spec; 5 = new 大分類 (avoid);
|
|
50
|
+
6 = hesitation whether to split a sheet; 7 = §7 checklist items skipped as undecidable;
|
|
51
|
+
8 = viewpoints not created because the reference viewpoint set lacks them; 9 = viewpoints not created because the
|
|
52
|
+
value is undefined; 10 = screen type chosen for a screen that matched none.
|
|
53
|
+
- For many cases, generate the JSON with a Python script (`$W/gen_part<N>.py`, open files with `encoding="utf-8"`)
|
|
54
|
+
instead of typing JSON — easier to fix and to re-run if you are interrupted.
|
|
55
|
+
- Do NOT modify any file in the repository. Write only `$W/part_<N>.json` (and your own scripts in `$W`).
|
|
56
|
+
Afterwards: `python -c "import json;json.load(open(r'<file>',encoding='utf-8'))"`.
|
|
57
|
+
|
|
58
|
+
When done, reply briefly: file name, case counts per major × minor, existing case IDs converted / total IDs in the
|
|
59
|
+
source files of your part, number of data_prep items, number of report_notes.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Check that every case ID of the existing test-case files appears in column E (case "spec") of spec.json.
|
|
3
|
+
|
|
4
|
+
Usage (from repo root):
|
|
5
|
+
python toolkit/skills/sdtk-test-case-xlsx/scripts/check_coverage.py <spec.json> KEY=<file.md> [KEY=<file.md> ...] \
|
|
6
|
+
[--id-regex '<regex with 1 group>'] [--exclude KEY-ID,KEY-ID ...]
|
|
7
|
+
|
|
8
|
+
An existing case "NL-01" of the file registered as LOGIN is covered when some case's "spec" contains
|
|
9
|
+
"LOGIN-NL-01" (split cases may add a suffix: LOGIN-NL-01-a). --exclude lists IDs deliberately not converted
|
|
10
|
+
(they must be explained in report §11-3). Exits 1 if any other ID is missing.
|
|
11
|
+
Default ID regex: a table row starting with an (optionally bold) ID such as | **NL-01** 🔴 |, | O9-16 |, | F1 |.
|
|
12
|
+
"""
|
|
13
|
+
import argparse
|
|
14
|
+
import json
|
|
15
|
+
import re
|
|
16
|
+
import sys
|
|
17
|
+
|
|
18
|
+
if hasattr(sys.stdout, "reconfigure"):
|
|
19
|
+
sys.stdout.reconfigure(encoding="utf-8")
|
|
20
|
+
|
|
21
|
+
DEFAULT_ID = r"^\|\s*\**([A-Z][A-Z0-9]*-?[0-9]+[a-z]?)\**"
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def main():
|
|
25
|
+
ap = argparse.ArgumentParser()
|
|
26
|
+
ap.add_argument("spec")
|
|
27
|
+
ap.add_argument("sources", nargs="+", help="KEY=path/to/file.md")
|
|
28
|
+
ap.add_argument("--id-regex", default=DEFAULT_ID)
|
|
29
|
+
ap.add_argument("--exclude", default="", help="comma-separated KEY-ID deliberately not converted")
|
|
30
|
+
a = ap.parse_args()
|
|
31
|
+
with open(a.spec, encoding="utf-8") as f:
|
|
32
|
+
spec = json.load(f)
|
|
33
|
+
cited = " ".join(c.get("spec", "") for sh in spec["sheets"] for c in sh["cases"])
|
|
34
|
+
pat = re.compile(a.id_regex, re.M)
|
|
35
|
+
excluded = {x.strip() for x in a.exclude.split(",") if x.strip()}
|
|
36
|
+
missing_total = 0
|
|
37
|
+
for src in a.sources:
|
|
38
|
+
key, path = src.split("=", 1)
|
|
39
|
+
with open(path, encoding="utf-8") as f:
|
|
40
|
+
ids = list(dict.fromkeys(pat.findall(f.read())))
|
|
41
|
+
ids = [i for i in ids if f"{key}-{i}" not in excluded]
|
|
42
|
+
missing = [i for i in ids if not re.search(rf"\b{re.escape(key)}-{re.escape(i)}(?![0-9A-Za-z])", cited)]
|
|
43
|
+
missing_total += len(missing)
|
|
44
|
+
print(f"{key}: {len(ids) - len(missing)}/{len(ids)} covered" + (f" — missing: {', '.join(missing)}" if missing else ""))
|
|
45
|
+
if missing_total:
|
|
46
|
+
sys.exit(f"{missing_total} existing case(s) not converted")
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
if __name__ == "__main__":
|
|
50
|
+
main()
|