manual-testing

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Manual Testing

手动测试

Verify current work through automated testing first, falling back to user verification only when necessary.
首先通过自动化测试验证当前工作,仅在必要时才请求用户进行验证。

Core Principle

核心原则

Automate everything possible. Only ask the user to manually verify what Claude cannot verify through tools.
尽可能自动化所有内容。 仅让用户手动验证Claude无法通过工具完成的部分。

Workflow

工作流程

1. Analyze Current Context

1. 分析当前上下文

Examine recent work to identify what needs testing:
  • Review recent file changes and conversation history
  • Identify the feature, fix, or change to verify
  • Determine testable behaviors and expected outcomes
检查近期工作以确定需要测试的内容:
  • 查看最近的文件变更和对话历史
  • 确定要验证的功能、修复或变更
  • 确定可测试的行为和预期结果

2. Classify Each Verification Step

2. 分类每个验证步骤

For each thing to verify, determine if Claude can test it automatically:
Claude CAN verify (do these automatically):
  • Code compiles/builds:
    npm run build
    ,
    cargo build
    ,
    go build
    , etc.
  • Tests pass:
    npm test
    ,
    pytest
    ,
    cargo test
    , etc.
  • Linting/type checking:
    eslint
    ,
    tsc --noEmit
    ,
    mypy
    , etc.
  • API responses:
    curl
    ,
    httpie
    , or scripted requests
  • File contents: Read files, grep for expected patterns
  • CLI tool output: Run commands and check output
  • Server starts: Start server, check for errors, verify endpoints respond
  • Database state: Query databases, check records exist
  • Log output: Tail logs, grep for expected/unexpected messages
  • Process behavior: Check exit codes, stdout/stderr content
  • File existence/permissions:
    ls
    ,
    stat
    ,
    test -f
  • JSON/config validity: Parse and validate structure
  • Port availability:
    lsof
    ,
    netstat
    , curl localhost
  • Git state: Check diffs, commits, branch state
Claude CANNOT verify (ask user):
  • Visual appearance (colors, layout, spacing, alignment)
  • Animations and transitions
  • User experience feel (responsiveness, intuition)
  • Cross-browser rendering
  • Mobile device behavior
  • Physical hardware interaction
  • Third-party service UIs (OAuth flows, payment forms)
  • Accessibility with actual screen readers
  • Performance perception (feels fast/slow)
对于每项需要验证的内容,判断Claude是否可以自动完成测试:
Claude可以自动验证(自动执行):
  • 代码编译/构建:
    npm run build
    ,
    cargo build
    ,
    go build
  • 测试通过情况:
    npm test
    ,
    pytest
    ,
    cargo test
  • 代码检查/类型校验:
    eslint
    ,
    tsc --noEmit
    ,
    mypy
  • API响应:
    curl
    ,
    httpie
    或脚本化请求
  • 文件内容:读取文件,搜索预期模式
  • CLI工具输出:运行命令并检查输出
  • 服务器启动:启动服务器,检查错误,验证端点是否响应
  • 数据库状态:查询数据库,检查记录是否存在
  • 日志输出:跟踪日志,搜索预期/非预期消息
  • 进程行为:检查退出码、标准输出/错误内容
  • 文件存在性/权限:
    ls
    ,
    stat
    ,
    test -f
  • JSON/配置有效性:解析并验证结构
  • 端口可用性:
    lsof
    ,
    netstat
    , curl localhost
  • Git状态:检查差异、提交、分支状态
Claude无法自动验证(请求用户完成):
  • 视觉外观(颜色、布局、间距、对齐方式)
  • 动画与过渡效果
  • 用户体验感受(响应速度、直观性)
  • 跨浏览器渲染效果
  • 移动设备行为
  • 物理硬件交互
  • 第三方服务UI(OAuth流程、支付表单)
  • 使用实际屏幕阅读器的可访问性
  • 性能感知(感觉快/慢)

3. Execute Automated Verifications

3. 执行自动化验证

Run all automatable checks first. Be thorough:
bash
undefined
首先运行所有可自动化的检查,确保全面:
bash
undefined

Example: Testing a web feature

Example: Testing a web feature

npm run build # Compiles? npm run lint # No lint errors? npm test # Tests pass? npm run dev & # Server starts? sleep 3 curl localhost:3000/api/endpoint # API responds correctly?

Report results as you go. If automated tests fail, stop and address before asking user to verify anything.
npm run build # Compiles? npm run lint # No lint errors? npm test # Tests pass? npm run dev & # Server starts? sleep 3 curl localhost:3000/api/endpoint # API responds correctly?

逐步报告结果。如果自动化测试失败,先解决问题,再请求用户进行任何验证。

4. User Verification (Only When Necessary)

4. 用户验证(仅在必要时)

For steps Claude cannot automate, present them sequentially with selectable outcomes:
Step N of M: [Brief description]

**Action:** [Specific instruction - what to do]

**Expected:** [What should happen if working correctly]
Then use AskUserQuestion with predicted outcomes:
  • 2-4 most likely outcomes as selectable options
  • First option: expected/success outcome
  • Remaining options: common failure modes
  • Free-text "Other" option is provided automatically
Example:
json
{
  "questions": [{
    "question": "How does the button look?",
    "header": "Visual check",
    "options": [
      {"label": "Looks correct", "description": "Blue button, proper spacing, readable text"},
      {"label": "Wrong color/style", "description": "Button exists but styling is off"},
      {"label": "Layout broken", "description": "Elements overlapping or misaligned"},
      {"label": "Not visible", "description": "Button missing or hidden"}
    ],
    "multiSelect": false
  }]
}
对于Claude无法自动化的步骤,按顺序呈现,并提供可选结果:
Step N of M: [Brief description]

**Action:** [Specific instruction - what to do]

**Expected:** [What should happen if working correctly]
然后使用AskUserQuestion工具,提供预测结果:
  • 2-4个最可能的结果作为可选选项
  • 第一个选项:预期/成功结果
  • 其余选项:常见失败模式
  • 系统会自动提供自由文本“其他”选项
示例:
json
{
  "questions": [{
    "question": "How does the button look?",
    "header": "Visual check",
    "options": [
      {"label": "Looks correct", "description": "Blue button, proper spacing, readable text"},
      {"label": "Wrong color/style", "description": "Button exists but styling is off"},
      {"label": "Layout broken", "description": "Elements overlapping or misaligned"},
      {"label": "Not visible", "description": "Button missing or hidden"}
    ],
    "multiSelect": false
  }]
}

5. Handle Results

5. 处理结果

Automated test fails: Stop and fix before proceeding.
User reports issue: Note it, ask if they want to investigate now or continue testing.
自动化测试失败: 停止当前流程,先修复问题再推进。
用户报告问题: 记录问题,询问用户是现在调查还是继续测试。

6. Summarize

6. 总结

After all steps complete:
  • List what was verified automatically (with pass/fail)
  • List what user verified (with results)
  • Summarize any issues found
  • Recommend next actions
所有步骤完成后:
  • 列出通过自动化验证的内容(包含通过/失败状态)
  • 列出用户验证的内容(包含结果)
  • 总结发现的所有问题
  • 推荐下一步行动

Guidelines

指南

  • Run automated checks in parallel when possible
  • Be creative with verification—most things can be tested programmatically
  • If unsure whether something can be automated, try it first
  • Keep user verification steps minimal and focused on truly visual/experiential checks
  • 尽可能并行运行自动化检查
  • 创造性地进行验证——大多数内容都可以通过编程方式测试
  • 如果不确定某项内容是否可以自动化,先尝试执行
  • 尽量减少用户验证步骤,专注于真正需要视觉/体验检查的部分