w03-testing-and-diagnostics

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

测试与诊断规范

Testing and Diagnosis Specification

适用于代码变更后的测试执行与排障,确保结果可靠、补救完整。

Suitable for test execution and troubleshooting after code changes, ensuring reliable results and complete remediation.

⚠️ 核心强制要求

⚠️ Core Mandatory Requirements

第一步:创建测试任务文档

Step 1: Create Test Task Document

测试开始前必须先创建
agent-task-log/ongoing/TEST_[日期]_[任务].md
完成后归档至
agent-task-log/archive/[年月]/
markdown
undefined
Must create first before starting testing
agent-task-log/ongoing/TEST_[Date]_[Task].md
After completion, archive to
agent-task-log/archive/[Year-Month]/
markdown
undefined

测试任务:[任务名称]

Test Task: [Task Name]

当前状态

Current Status

阶段:🔄 执行测试 下一步:运行单元测试
Phase: 🔄 Executing Tests Next Step: Run Unit Tests

进度

Progress

阶段状态
执行测试🔄 进行中
诊断(如需)⬜ 待定
PhaseStatus
Executing Tests🔄 In Progress
Diagnosis (if needed)⬜ Pending

测试记录

Test Records

(待填写)
undefined
(To be filled)
undefined

第二步:执行测试

Step 2: Execute Tests

  • 后端变更
    backend/**
    )→ 单元测试
  • 前端变更
    frontend/**
    )→ 浏览器测试
  • 全栈变更 → 先单元测试,再浏览器测试
  • Backend Changes (
    backend/**
    ) → Unit Tests
  • Frontend Changes (
    frontend/**
    ) → Browser Tests
  • Full-stack Changes → First run unit tests, then browser tests

第三步:更新文档

Step 3: Update Document

测试完成后立即更新文档,记录结果
Update the document immediately after test completion and record the results

基线约束

Baseline Constraints

  • 测试完成前不得提交交付结果
  • 失败时必须先修复再继续
  • 无法执行测试时需说明原因和补测计划

  • Do not submit delivery results before test completion
  • Must fix issues before proceeding if tests fail
  • If tests cannot be executed, explain the reason and make a supplementary test plan

AI Agent 行为要求

AI Agent Behavior Requirements

测试任务开始时

At the Start of Test Task

  1. 先创建 TEST_*.md 文档
  2. 根据变更类型选择测试
  3. 执行测试并更新文档
  4. 失败时触发诊断流程(最多三轮)
  1. First create the TEST_*.md document
  2. Select tests based on the type of change
  3. Execute tests and update the document
  4. Trigger diagnosis workflow if tests fail (maximum 3 rounds)

诊断流程

Diagnosis Workflow

每轮:观察 → 推断 → 操作 → 结果
升级条件
  • 三轮排查无果
  • 高风险或涉及架构/安全决策
Each round: Observe → Infer → Operate → Result
Escalation Conditions:
  • No results after 3 rounds of troubleshooting
  • High-risk or involves architecture/security decisions

恢复执行

Resume Execution

新对话检查
agent-task-log/TEST_*.md
,从"当前状态"继续
New conversations check
agent-task-log/TEST_*.md
and continue from the "Current Status"

人机协作

Human-AI Collaboration

AI 无法 100% 自主完成所有测试,部分场景需要人类协助:
可请求人类协助的情况
  • 浏览器页面需要手动打开或导航
  • 需要人工验证视觉效果
  • 涉及复杂的用户交互流程
  • AI 工具无法访问的系统资源
协作方式
  1. 明确告知用户需要协助的具体操作
  2. 用户完成后,AI 继续后续测试步骤
  3. 记录协作点到测试文档
原则:半自动化测试同样有效,AI 分担大部分工作,人类补充 AI 难以处理的环节。
AI cannot complete all tests 100% autonomously; human assistance is required in some scenarios:
Situations where human assistance can be requested:
  • Browser pages need to be manually opened or navigated
  • Manual verification of visual effects is required
  • Involves complex user interaction flows
  • System resources inaccessible to AI tools
Collaboration Method:
  1. Clearly inform the user of the specific operations requiring assistance
  2. After the user completes the task, AI continues with subsequent test steps
  3. Record collaboration points in the test document
Principle: Semi-automated testing is also effective; AI handles most of the work, while humans supplement the parts that AI finds difficult to handle.

与 W00 协同(自动 + 手动)

Collaboration with W00 (Automatic + Manual)

  • 进入测试前可自动调用
    w00-workflow-checkpoint checkpoint
    记录测试起点与下一步。
  • 测试失败并进入诊断时,可自动更新 issue 为
    status:blocked
    并记录 blocker。
  • 用户可手动执行
    /w00-workflow-checkpoint
    补记测试节点与读档信息。

  • Before entering testing, automatically call
    w00-workflow-checkpoint checkpoint
    to record the test starting point and next step.
  • When tests fail and enter diagnosis, automatically update the issue to
    status:blocked
    and record the blocker.
  • Users can manually execute
    /w00-workflow-checkpoint
    to supplement test nodes and checkpoint information.

禁止事项

Prohibited Items

  • ❌ 跳过或延迟测试
  • ❌ 未记录结果就报告完成
  • ❌ 失败后继续提交

  • ❌ Skip or delay testing
  • ❌ Report completion without recording results
  • ❌ Submit changes after test failure

工具脚本

Tool Scripts

  • scripts/run_test_workflow.py
    - 单元测试工作流
  • scripts/run_browser_tests.py
    - 浏览器测试工作流
  • scripts/auto_diagnose.py
    - 自动诊断

  • scripts/run_test_workflow.py
    - Unit test workflow
  • scripts/run_browser_tests.py
    - Browser test workflow
  • scripts/auto_diagnose.py
    - Automatic diagnosis

参考资料

Reference Materials

  • references/testing-workflow.md
    - 测试工作流详细说明
  • references/browser-testing.md
    - 浏览器测试详细说明
  • references/diagnosis-workflow.md
    - 诊断流程详细说明
  • references/testing-workflow.md
    - Detailed testing workflow description
  • references/browser-testing.md
    - Detailed browser testing description
  • references/diagnosis-workflow.md
    - Detailed diagnosis workflow description