prd-auto-test-loop

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

PRD 自动化测试闭环

PRD Automated Test Closed Loop

概览

Overview

使用此技能将发布测试固定为:
主回归基线 + PRD 增量测试
跨版本维护一套共享主回归测试。 每个 PRD 版本仅增加新增或变更相关用例。 将产物输出到
自动化测试/<version>/
Use this skill to standardize release testing as:
Main Regression Baseline + PRD Incremental Testing
.
Maintain a set of shared main regression tests across versions. Only add test cases related to new or changed features for each PRD version. Output artifacts to
automated-testing/<version>/
.

工作流

Workflow

  1. 从 PRD 锁定范围。
  • 提取版本目标、测试范围、非范围、验收标准。
  • 若本次是增量变更,拒绝“整套重写测试”。
  1. 定义测试分层与边界。
  • 将验收标准映射为
    Unit / Integration / E2E
  • 读取
    references/自动化测试封装指南.md
    的边界章节,标记
    A/H/A+H
  1. 初始化版本测试目录。
  • 读取
    references/自动化测试封装指南.md
    的初始化命令与模板。
  • 创建
    自动化测试/<version>/
    ,并生成
    TEST_PLAN.md
    TEST_REPORT.md
  1. 实现增量测试。
  • 优先复用既有主回归用例。
  • 仅新增 PRD 差异用例到
    tests/
  • 保持断言确定性,避免脆弱 UI 选择器。
  1. 执行 AI 自测闭环。
  • 固定顺序:
    Unit -> Integration -> E2E
  • 失败时按根因修复并重跑(最多 3 轮)。
  • 若被环境阻塞,明确记录阻塞项并停止宣称通过。
  1. 产出测试报告。
  • 按模板填写命令、通过率、失败项、剩余风险。
  • 输出发布门禁结论:
    PASS
    FAIL
  1. Lock scope from PRD.
  • Extract version objectives, test scope, out-of-scope items, and acceptance criteria.
  • If this is an incremental change, reject "rewriting the entire test suite".
  1. Define test layers and boundaries.
  • Map acceptance criteria to
    Unit / Integration / E2E
    .
  • Read the boundary chapter in
    references/Automated Test Encapsulation Guide.md
    and mark
    A/H/A+H
    .
  1. Initialize version test directory.
  • Read the initialization commands and templates in
    references/Automated Test Encapsulation Guide.md
    .
  • Create
    automated-testing/<version>/
    and generate
    TEST_PLAN.md
    and
    TEST_REPORT.md
    .
  1. Implement incremental testing.
  • Prioritize reusing existing main regression test cases.
  • Only add PRD differential test cases to
    tests/
    .
  • Maintain deterministic assertions and avoid fragile UI selectors.
  1. Execute AI self-test closed loop.
  • Fixed order:
    Unit -> Integration -> E2E
    .
  • Fix based on root cause and rerun upon failure (max 3 rounds).
  • If blocked by environment, clearly record the blocking items and stop claiming pass.
  1. Generate test report.
  • Fill in commands, pass rate, failed items, and remaining risks according to the template.
  • Output release gate conclusion:
    PASS
    or
    FAIL
    .

规则

Rules

  • 不要每个 PRD 都从零重建整套测试。
  • 必须同时维护“主回归套件 + 版本增量套件”。
  • 每个版本必须绑定自己的
    TEST_PLAN
    TEST_REPORT
  • 必须给出可复现命令和结果摘要,禁止模糊结论。
  • 不要声称覆盖全部质量风险,必须列出人工补测项。
  • Do not rebuild the entire test suite from scratch for each PRD.
  • Must maintain both "Main Regression Suite + Version Incremental Suite".
  • Each version must be bound to its own
    TEST_PLAN
    and
    TEST_REPORT
    .
  • Must provide reproducible commands and result summaries; vague conclusions are prohibited.
  • Do not claim to cover all quality risks; must list manual supplementary test items.

自动化边界矩阵

Automation Boundary Matrix

适合自动化(建议 AI 覆盖)

Suitable for Automation (Recommended AI Coverage)

  • 功能正确性(状态流转、接口处理、校验规则)
  • 回归路径(历史缺陷防回归)
  • 确定性边界场景(空值、非法值、重复操作)
  • 稳定冒烟流程(启动、关键导航、保存/提交)
  • 可量化非功能指标(超时、错误率、崩溃率)
  • Functional correctness (state transitions, interface handling, validation rules)
  • Regression paths (preventing recurrence of historical defects)
  • Deterministic boundary scenarios (null values, illegal values, repeated operations)
  • Stable smoke test processes (startup, key navigation, save/submit)
  • Quantifiable non-functional indicators (timeout, error rate, crash rate)

优先人工验证(建议人工兜底)

Priority Manual Verification (Recommended Manual Backup)

  • 可用性与交互顺滑度
  • 视觉质感与品牌一致性
  • 业务策略合理性
  • 开放式探索路径
  • 产品取舍与发布优先级判断
  • Usability and interaction smoothness
  • Visual texture and brand consistency
  • Rationality of business strategies
  • Open exploration paths
  • Product trade-offs and release priority judgment

验收标准标记法

Acceptance Criteria Marking Method

  • A
    :可完全自动化
  • H
    :仅人工验证
  • A+H
    :自动化 + 人工联合验证
  • A
    : Fully automatable
  • H
    : Manual verification only
  • A+H
    : Combined automation + manual verification

TEST_PLAN 模板

TEST_PLAN Template

md
undefined
md
undefined

TEST_PLAN(<version>

TEST_PLAN(<version>

1. 测试范围

1. 测试范围

  • PRD:<path>
  • 范围内:
  • 非范围:
  • PRD:<path>
  • 范围内:
  • 非范围:

2. 完成门槛

2. 完成门槛

  1. 计划内用例:<x>/<x> 通过
  2. P0 用例通过率:100%
  3. 连续两轮稳定通过
  4. 无阻断/严重缺陷遗留
  1. 计划内用例:<x>/<x> 通过
  2. P0 用例通过率:100%
  3. 连续两轮稳定通过
  4. 无阻断/严重缺陷遗留

3. 用例清单

3. 用例清单

Unit

Unit

  • UT-xx:
  • UT-xx:

Integration

Integration

  • IT-xx:
  • IT-xx:

E2E

E2E

  • E2E-xx:
  • E2E-xx:

4. 执行顺序

4. 执行顺序

  1. Unit
  2. Integration
  3. E2E
  4. 自动修复循环(最多 3 轮)
  1. Unit
  2. Integration
  3. E2E
  4. 自动修复循环(最多 3 轮)

5. 输出产物

5. 输出产物

  • TEST_REPORT.md
  • 命令执行结果摘要
undefined
  • TEST_REPORT.md
  • 命令执行结果摘要
undefined

TEST_REPORT 模板

TEST_REPORT Template

md
undefined
md
undefined

TEST_REPORT(<version>

TEST_REPORT(<version>

1. 结果摘要

1. 结果摘要

  • 日期:
  • PRD:
  • 结论:PASS | FAIL
  • 日期:
  • PRD:
  • 结论:PASS | FAIL

2. 执行命令与结果

2. 执行命令与结果

  • <command> - result:
  • <command> - result:

3. 分层覆盖结果

3. 分层覆盖结果

  • Unit:passed/total
  • Integration:passed/total
  • E2E:passed/total
  • Unit:passed/total
  • Integration:passed/total
  • E2E:passed/total

4. 失败用例

4. 失败用例

  • 用例 ID:
  • 现象:
  • 根因:
  • 修复状态:
  • 用例 ID:
  • 现象:
  • 根因:
  • 修复状态:

5. 剩余风险(人工补测)

5. 剩余风险(人工补测)

  • 风险点:
  • 自动化无法完全覆盖原因:
  • 风险点:
  • 自动化无法完全覆盖原因:

6. 发布门禁

6. 发布门禁

  • 门禁检查状态:
  • 最终决策:
undefined
  • 门禁检查状态:
  • 最终决策:
undefined

版本目录初始化命令

Version Directory Initialization Command

在项目根目录执行:
bash
version="V0.6"
base_dir="自动化测试/$version"
mkdir -p "$base_dir/tests/unit" "$base_dir/tests/integration" "$base_dir/tests/e2e"

cat > "$base_dir/TEST_PLAN.md" <<'TPL'
Execute in the project root directory:
bash
version="V0.6"
base_dir="自动化测试/$version"
mkdir -p "$base_dir/tests/unit" "$base_dir/tests/integration" "$base_dir/tests/e2e"

cat > "$base_dir/TEST_PLAN.md" <<'TPL'

TEST_PLAN(V0.6)

TEST_PLAN(V0.6)

1. 测试范围

1. 测试范围

  • PRD:
  • 范围内:
  • 非范围:
  • PRD:
  • 范围内:
  • 非范围:

2. 完成门槛

2. 完成门槛

  1. 计划内用例全部通过
  2. P0 用例通过率 100%
  3. 连续两轮稳定通过
  4. 无阻断/严重缺陷遗留 TPL
cat > "$base_dir/TEST_REPORT.md" <<'RPT'
  1. 计划内用例全部通过
  2. P0 用例通过率 100%
  3. 连续两轮稳定通过
  4. 无阻断/严重缺陷遗留 TPL
cat > "$base_dir/TEST_REPORT.md" <<'RPT'

TEST_REPORT(V0.6)

TEST_REPORT(V0.6)

1. 结果摘要

1. 结果摘要

  • 日期:
  • 结论: RPT
undefined
  • 日期:
  • 结论: RPT
undefined