Help us improve
Share bugs, ideas, or general feedback.
From test-doc-generator
Generates test cases, plans, and reports from requirement documents (PDF/Word/Markdown) using equivalence partitioning, boundary analysis, scenarios, and error guessing. Builds traceability matrices, prioritizes tests (P0-P3), and learns project context persistently. Triggers on mentions of test generation phrases.
npx claudepluginhub himicoswilson/himi-claude-plugins --plugin test-doc-generatorHow this skill is triggered — by the user, by Claude, or both
Slash command
/test-doc-generator:generate-test-docsThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
从需求文档自动生成专业测试文档,具备项目感知、持续学习和专业测试设计方法能力。
references/INTERACTION-PATTERNS.mdreferences/LEARNING-RULES.mdreferences/MEMORY-SCHEMA.mdreferences/PARSING-RULES.mdreferences/TEST-DESIGN-METHODS.mdreferences/TEST-PRIORITY.mdreferences/TRACEABILITY.mdscripts/__pycache__/extract_document.cpython-314.pycscripts/__pycache__/generate_excel.cpython-314.pycscripts/__pycache__/memory_manager.cpython-314.pycscripts/extract_document.pyscripts/generate_excel.pyscripts/memory_manager.pyGenerates structured, prioritized test plans from feature specs, Figma designs, or code. Includes risk analysis, coverage matrix, automation candidates. Saves Markdown to docs/testplans/.
Guides users through a structured interview to generate professional QA Test Plan documents (.docx or .pdf) with section navigation and defaults.
Generates complete test case packages with traceability matrices, coverage summaries, detailed cases, and execution instructions from approved LLD, Test Strategy, PRD, API/HLD. Use after LLD completion and strategy confirmation.
Share bugs, ideas, or general feedback.
从需求文档自动生成专业测试文档,具备项目感知、持续学习和专业测试设计方法能力。
| 模式 | 名称 | 适用场景 | 确认方式 |
|---|---|---|---|
quick | 快速模式 | 日常生成、熟悉流程 | 回车继续,仅问题时询问 |
expert | 专家模式 | 首次使用、精细控制 | 每阶段确认,完整预览 |
| 检查点 | 阶段 | Quick 模式 | Expert 模式 |
|---|---|---|---|
| 解析确认 | Phase 2.5 | 摘要 + 有问题时询问 | 完整列表 + 等待确认 |
| 歧义处理 | Phase 2.6 | 仅关键歧义 | 所有歧义 |
| 生成预览 | Phase 2.8 | 统计数据 | 统计 + 样例 + 可调整 |
| 输出选择 | Phase 2.9 | 确认默认配置 | 完整格式选择 |
切换模式 / 快速模式 / 专家模式.memory/user-preferences.json检测或询问用户项目结构:
./templates)./requirements).memory 文件夹用于存储学习数据安装依赖:
pip install openpyxl PyMuPDF python-docx
| 需求特征 | 推荐方法 |
|---|---|
| 有明确输入范围/格式要求 | 等价类划分 + 边界值分析 |
| 涉及业务流程/多步骤操作 | 场景法 |
| 历史缺陷多/高风险模块 | 错误推测法 |
等价类划分法 (EP)
边界值分析法 (BVA)
场景法 (ST)
错误推测法 (EG)
1. 等价类划分 → 识别所有输入的有效/无效等价类
↓
2. 边界值分析 → 对每个等价类的边界进行测试
↓
3. 场景法 → 覆盖主要业务流程(基本流+备选流+异常流)
↓
4. 错误推测 → 补充经验性测试用例
生成用例时自动关联需求ID,输出包含:
自动识别需求文档中的ID模式:
REQ_001、REQ-123F1.2、F-3.1.2US_042PROJ-123若无明确ID,自动生成:MOD_{模块缩写}_{序号}
| 级别 | 定义 | 来源 |
|---|---|---|
| P0 | 核心功能,不可用则系统无法使用 | 基本流用例 |
| P1 | 主要功能,影响核心业务流程 | 备选流 + 边界值 |
| P2 | 次要功能,不影响主流程 | 异常流 + 错误推测 |
| P3 | 体验优化,边缘场景 | 边缘错误推测 |
| 测试集 | 包含用例 | 执行时机 |
|---|---|---|
| 冒烟测试 | 所有 P0 | 每次构建 |
| 核心回归 | P0 + P1 | 每日/提测 |
| 全量回归 | 所有 | 发版前 |
templates/、requirements/、docs/ 等目录.memory/project-context.json| 格式 | 扩展名 | 提取脚本 |
|---|---|---|
scripts/extract_document.py --format pdf | ||
| Word | .docx | scripts/extract_document.py --format docx |
| Markdown | .md | 直接读取 |
| 富文本 | .rtf | scripts/extract_document.py --format rtf |
Skill 在项目中创建 .memory/ 文件夹,存储学习数据:
{
"project_name": "电商平台",
"detected_at": "2024-01-15",
"template_dir": "./templates",
"requirements_dir": "./requirements",
"output_dir": "./test-docs"
}
{
"test_case": {
"source": "./templates/测试用例模板.xlsx",
"columns": ["用例编号", "模块名称", "用例标题", "优先级", "关联需求ID", "设计方法", "前置条件", "测试步骤", "预期结果", "实际结果", "是否通过", "回归类型", "备注"],
"id_format": "TC_{module}_{seq:03d}",
"learned_at": "2024-01-15"
}
}
{
"domain_terms": {
"SKU": "库存单位",
"GMV": "商品交易总额"
},
"module_abbreviations": {
"用户登录": "LOGIN",
"购物车": "CART"
}
}
{
"generations": [
{
"date": "2024-01-15",
"type": "test_case",
"source": "PRD-v1.0.pdf",
"output": "登录模块_测试用例_v1.xlsx",
"case_count": 25,
"coverage_rate": "95%"
}
]
}
.memory/ 文件夹template-schemas.jsonterminology.jsonuser-preferences.jsonscripts/extract_document.py 提取文本.memory/terminology.json 理解领域术语使用 AskUserQuestion 确认解析结果:
Expert 模式:
显示完整解析结果表格:
- 识别的模块列表(名称、需求数、缩写)
- 提取的需求ID列表(ID、名称、验收条件数)
- 识别的业务规则
- 识别的边界条件
等待用户确认:确认 / 修改 / 重新解析
Quick 模式:
显示摘要:已识别 X 个模块,Y 条需求,Z 条规则
仅在发现警告时询问用户
无警告则自动继续
对检测到的歧义需求逐一询问:
需求原文:{text}
歧义类型:边界不明确 / 规则冲突 / 条件缺失
我的理解:{interpretation}
请选择:
1. 接受我的理解
2. 提供不同解释
3. 跳过此需求
4. 标记为待确认
使用 AskUserQuestion 预览生成方案:
Expert 模式:
显示优先级分布:P0/P1/P2/P3 数量和占比
显示设计方法分布:EP/BVA/ST/EG
显示样例用例:每个优先级展示1条
可选操作:
- 调整优先级分布
- 增加/减少特定类型用例
- 预览特定模块
Quick 模式:
显示统计:将生成 X 条用例,P0:X | P1:X | P2:X | P3:X
仅在分布异常时询问(如 P0 > 20%)
正常则回车继续
使用 AskUserQuestion 选择输出格式:
Expert 模式:
多选输出格式:
- Excel 测试用例
- Markdown 测试用例
- 测试计划文档
- 测试报告模板
单选追溯矩阵:
- 包含在Excel中
- 单独生成文件
- 不生成
Quick 模式:
确认默认配置(基于上次选择或默认):
- ✅ Excel 测试用例(含追溯矩阵)
- ✅ 覆盖率统计
回车确认,或输入"更多"选择其他格式
.memory/template-schemas.json 获取模板结构scripts/generate_excel.py 生成 Excel(含追溯矩阵)generation-history.jsonterminology.jsonuser-preferences.json默认列:
| 列名 | 说明 |
|---|---|
| 用例编号 | TC_{MODULE}_{SEQ:03d} |
| 模块名称 | 功能模块 |
| 用例标题 | 测试点简述 |
| 优先级 | P0/P1/P2/P3(下拉选择,带颜色) |
| 关联需求ID | REQ_XXX(支持多个,逗号分隔) |
| 设计方法 | EP/BVA/ST/EG |
| 前置条件 | 执行前提 |
| 测试步骤 | 详细操作步骤 |
| 预期结果 | 期望行为 |
| 实际结果 | 执行时填写 |
| 是否通过 | 通过/未通过/阻塞/未执行 |
| 回归类型 | 冒烟/核心/全量 |
| 备注 | 补充说明 |
额外 Sheet(启用追溯时):
固定8章节结构:
固定5章节结构:
python3 "${SKILL_ROOT}/scripts/extract_document.py" \
--input "/path/to/PRD.pdf" \
--format pdf \
--output "/tmp/prd-content.json"
python3 "${SKILL_ROOT}/scripts/generate_excel.py" \
--output "测试用例.xlsx" \
--data '[{"用例编号":"TC_LOGIN_001", "优先级":"P0", "关联需求ID":"REQ_001", ...}]' \
--traceability \
--requirements '[{"id":"REQ_001", "name":"用户登录"}]'
python3 "${SKILL_ROOT}/scripts/memory_manager.py" \
--action init \
--project "/path/to/project"
"更新术语表" → 重新扫描并更新 terminology.json
"重新学习模板" → 重新解析模板结构
"清除记忆" → 删除 .memory 文件夹
.memory/user-preferences.json.memory 文件夹应加入 .gitignore(可选)