mirror of
https://github.com/bmad-code-org/BMAD-METHOD.git
synced 2026-08-29 03:44:18 +08:00
cede485217
* feat(docs): add sidebar order validator
Adds tools/validate-sidebar-order.js to validate sidebar.order values
in YAML frontmatter across English and translated docs.
Checks for duplicate orders, gaps in sequence, and missing order fields.
For translations, also warns on order drift from English counterparts.
Wired into the quality script as docs:validate-sidebar.
* fix(validate-sidebar): tighten language detection and drift guard, add docstrings
* fix(validate-sidebar): replace subdirectory heuristic with locale pattern matching
detectLanguageDirs() previously classified any top-level docs/ directory
containing subdirectories as a translation language. This was too broad —
if an English section ever gained nested subfolders it would be silently
excluded from validation.
Replaced with a BCP 47 locale-code regex (/^[a-z]{2}(?:-[a-zA-Z]{2})?$/)
that matches known patterns (cs, fr, vi-vn, zh-cn) and won't falsely
classify content sections like explanation/ or reference/.
* fix(validate-sidebar): guard drift check against undefined order values
extractSidebarOrder() returns { hasSidebar: false } when no sidebar block
exists, leaving order as undefined rather than null. The drift check only
guarded against null, allowing undefined values to emit noisy warnings
like "Order drift: ... order undefined".
Changed the guard to typeof === 'number' which correctly excludes both
undefined and null without relying on a specific sentinel value.
* chore(validate-sidebar): add JSDoc docstrings to all functions
Adds @param and @returns annotations to extractSidebarOrder,
detectLanguageDirs, getEnglishSections, checkDirectory,
checkTranslationDrift, and relativePath.
* fix(validate-sidebar): add to pre-commit hook
* refactor(validate-sidebar): harden parsing and edge-case handling
Refactor to main() wrapper with pure return-based APIs, single directory
scan, and shared reporting. Harden frontmatter parsing (anchored delimiter,
direct-child-only order extraction, flow mapping support) and validation
(Infinity/zero guard, gap flood cap, multi-segment locales, graceful ENOENT).
* docs: fix sidebar.order duplicates and gaps across all locales
Resolves all validator errors flagged by the new
tools/validate-sidebar-order.js check.
English (docs/{explanation,how-to,reference}/):
- Renumbered to remove duplicates; established reading order
for new explanation pages added since orders were last set.
Translations (cs, fr, vi-vn, zh-cn):
- Mirrored English structural ordering where files exist, then
compacted to 1..N within each directory to eliminate gaps
caused by missing translation files.
Non-blocking drift warnings remain where translation directories
have fewer files than English; these are expected per the
validator's design.
---------
Co-authored-by: Brian Madison <bmadcode@gmail.com>
4.0 KiB
4.0 KiB
title, description, sidebar
| title | description | sidebar | ||
|---|---|---|---|---|
| 测试选项 | 内置 QA workflow 与 TEA 模块对比:何时用哪个、各自边界是什么 |
|
BMad 有两条测试路径:
- 内置 QA workflow:快速生成可运行测试
- TEA(可选模块):企业级测试策略与治理能力
该选内置 QA 还是 TEA?
| 维度 | 内置 QA | TEA 模块 |
|---|---|---|
| 最适合 | 中小项目、快速补覆盖 | 大型项目、受监管或复杂业务 |
| 安装成本 | 无需额外安装(BMM 内置) | 需通过安装器单独选择 |
| 方法 | 先生成测试,再迭代 | 先定义策略,再执行并追溯 |
| 测试类型 | API + E2E | API、E2E、ATDD、NFR 等 |
| 风险策略 | 快乐路径 + 关键边界 | P0-P3 风险优先级 |
| workflow 数量 | 1(Automate) | 9(设计/自动化/审查/追溯等) |
:::tip[默认建议] 大多数项目先用内置 QA workflow。只有当你需要质量门控、合规追溯或系统化测试治理时,再引入 TEA。 :::
内置 QA Workflow
内置 QA workflow(bmad-qa-generate-e2e-tests)是 BMM 模块的一部分,通过 Developer 智能体调用。目标是用你现有测试栈快速落地测试,不要求额外配置。
触发方式:
- 菜单触发器:
QA(通过 Developer 智能体) - skill:
bmad-qa-generate-e2e-tests
QA Workflow 会做什么
QA Automate 流程通常包含 5 步:
- 检测现有测试框架(如 Jest、Vitest、Playwright、Cypress)
- 确认待测功能(手动指定或自动发现)
- 生成 API 测试(状态码、结构、主路径与错误分支)
- 生成 E2E 测试(语义定位器 + 可见结果断言)
- 执行并修复基础失败项
默认风格:
- 仅使用标准框架 API
- UI 测试优先语义定位器(角色、标签、文本)
- 测试互相独立,不依赖顺序
- 避免硬编码等待/休眠
:::note[范围边界]
QA workflow 只负责”生成测试”。如需实现质量评审与故事验收,请配合代码审查 workflow(CR / bmad-code-review)。
:::
何时用内置 QA
- 要快速补齐某个功能的测试覆盖
- 团队希望先获得可运行基线,再逐步增强
- 项目暂不需要完整测试治理体系
TEA(Test Architect)模块
TEA 提供专家测试 agent(Murat)与 9 个结构化 workflow,覆盖策略、执行、审查、追溯和发布门控。
外部资源(英文):
安装: npx bmad-method install 后选择 TEA 模块。
TEA 的 9 个 workflow
| Workflow | 用途 |
|---|---|
| Test Design | 按需求建立测试策略 |
| ATDD | 基于验收标准驱动测试设计 |
| Automate | 使用高级模式生成自动化测试 |
| Test Review | 评估测试质量与覆盖完整性 |
| Traceability | 建立“需求—测试”追溯链路 |
| NFR Assessment | 评估性能/安全等非功能需求 |
| CI Setup | 配置 CI 中的测试执行 |
| Framework Scaffolding | 搭建测试工程基础结构 |
| Release Gate | 基于数据做发布/不发布决策 |
何时用 TEA
- 需要合规、审计或强追溯能力
- 需要跨功能做风险优先级管理
- 发布前存在明确质量门控流程
- 业务复杂,必须先建策略再写测试
测试放在流程的哪个位置
按 BMad workflow-map,测试位于阶段 4(实施):
- epic 内逐个 story:开发(
DS/bmad-dev-story)+ 代码审查(CR/bmad-code-review) - epic 完成后:用
QA(通过 Developer 智能体)或 TEA 的 Automate 统一生成/补齐测试 - 最后执行复盘(
bmad-retrospective)
内置 QA workflow 主要依据代码直接生成测试;TEA 可结合上游规划产物(如 PRD、architecture)实现更强追溯。