SuperAPI AI Directory

bug-reporting

Testing & quality

View repository

Updated 10-16 09:30

About this skill

Bug Reporting

References: Cem Kaner, "Lessons Learned in Software Testing", Google Bug Tracking Best Practices, ISTQB Foundation.

Applicable Scenarios

  • A Bug is found during testing and needs to be recorded
  • Bug reproduction / tracking / verification
  • Bug severity and priority assessment
  • Bug root cause analysis (collaboration with developers)
  • Bugs are captured as regression test cases

Core Principles

1. Bug 报告是给开发看的
   开发能 5 分钟内复现 = 好报告
  1. Title = module + symptom + key condition "Login fails" is a garbage title

  2. Minimal reproduction path Remove irrelevant steps, keep the necessary ones

  3. Expected vs actual must be explicit Developers must not have to guess what you want

  4. Severity × Priority kept separate Severity = size of impact (judged by QA) Priority = urgency of fix (judged by PM)

  5. Reproduction rate must be stated "Intermittent" / "100% reproducible" differ enormously in information value


## 好 Bug 标题 vs 坏 Bug 标题

| 坏标题 | 好标题 |
|--------|--------|
| 登录失败 | [登录] 输入超过 64 字符的邮箱时返回 500 而非 400 |
| 提交按钮没用 | [订单创建] 网络慢时(>3s)连续点击导致重复创建 |
| 显示错误 | [订单列表] 时区切换后 created_at 显示错误(晚 8 小时) |
| 性能问题 | [搜索] 关键词包含特殊字符 % 时响应时间从 200ms 增至 30s |

## 复现步骤(最小化)

```text
原则:删一步还能复现,就再删

❌ 长流程:
  1. 注册账号
  2. 登录
  3. 充值 100
  4. 浏览商品
  5. 加入购物车
  6. 结算
  7. 支付
  8. 退款 → 出问题

✅ 最小:
  前置:已存在状态=paid 的订单 ORD-123
  1. POST /orders/ORD-123/refund {"amount": -100}
  2. 观察响应

Required Fields (Cem Kaner Model)

1. 标题(含模块 + 现象 + 条件)
2. 环境(版本 / 浏览器 / 设备 / 数据库)
3. 账号(角色 / 租户 / 测试账号)
4. 前置条件(最小数据准备)
5. 复现步骤(编号清晰)
6. 预期结果
7. 实际结果
8. 截图 / 录屏 / 日志 / trace_id
9. 严重度 + 优先级
10. 复现率(100% / 50% / 偶发)
11. 影响范围(用户 / 功能 / 环境)
12. 是否需要立即缓解

Severity

Level Meaning Example
S0 Fatal Data loss / financial loss / all users blocked / security vulnerability Duplicate charge / data overwritten / SQL injection
S1 Critical Core functionality unavailable / some users blocked Login fails / payment fails
S2 Normal Functionality incomplete / workaround exists Some fields not displayed / incorrect sorting
S3 Minor UI / copy / edge cases Copy typo / pixel offset

Priority

Level Meaning Time to fix
P0 Blocks release Immediately
P1 Must fix in this version This iteration
P2 Fix in next version Next iteration
P3 See the schedule Anytime

Note: S and P need not be the same. For example: an S3 copy error but appearing on the landing page → P0, fix immediately.

Bug Lifecycle (ISTQB)

New(新建)
  ↓
Assigned(分配)
  ↓
In Progress(修复中)
  ↓
Fixed(已修复)
  ↓
Verified(QA 验证通过)
  ↓
Closed(关闭)

或:
  ↓
Reopened(验证失败,重新打开)
  ↓
(回到 In Progress)

或:
  ↓
Wont Fix / Duplicate / Cannot Reproduce

State Transition Rules

QA 操作:New / Verified / Closed / Reopened
Dev 操作:Assigned / In Progress / Fixed / Wont Fix
PM 操作:调整优先级 / Wont Fix 决策 / 关闭

Workflow for Reporting a Bug

1. 发现现象
   - 当前操作 / 数据 / 环境
   ↓
2. 尝试最小复现
   - 删步骤直到不能复现
   ↓
3. 收集证据
   - 截图 / 录屏 / 日志 / trace_id / cURL
   ↓
4. 评估影响
   - 严重度 / 复现率 / 影响范围
   ↓
5. 写报告
   - 标题 + 复现 + 预期 + 实际 + 证据
   ↓
6. 标定优先级
   - 与 PM 沟通
   ↓
7. 紧急的报告先短信 / 群里说
   - S0 / P0 不能只靠 ticket
   ↓
8. 修复后验证
   - 原路径 + 边界 + 回归套件
   ↓
9. 转化为回归用例
   - 见 regression-testing
   ↓
10. 沉淀经验
    - 同类问题的根因 → field-journal

Handling Non-Reproducible Bugs

1. 收集所有可能的状态
   - 时间 / 数据 / 用户 / 环境 / 时序

2. 增加日志
   - 与开发协作加 debug 日志

3. 监控触发条件
   - 用户上报 / 客诉 / 监控告警

4. 不立即关 "Cannot Reproduce"
   - 标 "Pending Reproduction" 跟踪 1 周

5. 实在再现不了
   - 关闭 + field-journal 记录现象 + 触发条件假设

Defect Distribution Analysis

按模块:哪个模块 Bug 最多 → 重点测
按严重度:S0/S1 占比 → 上线就绪度
按发现阶段:单元 / 集成 / E2E / 探索 / 生产
  → 越晚发现,成本越高
按根因类别:
  - 需求不清
  - 设计缺陷
  - 编码错误
  - 配置问题
  - 数据问题
  - 第三方
按修复时间:
  - 平均修复时间(MTTR)

Quality Self-Check

□ 标题包含模块 + 现象 + 条件
□ 复现步骤是最小路径
□ 预期 vs 实际清晰
□ 截图 / 日志 / trace_id 完整
□ 严重度和优先级有依据
□ 复现率说明
□ 影响范围清楚
□ S0/P0 同步通知(不只靠 ticket)
□ 修复后验证 = 原路径 + 边界 + 回归
□ 同类 Bug 已转回归用例

Common Pitfalls

  1. Title "Login fails"——Developers don't know where or under what conditions
  2. Reproduction steps too long——7 of the 9 steps are irrelevant
  3. No expected result——Developers don't know what you want
  4. Screenshot but no text description——Can't be searched, hard to archive
  5. Missing trace_id——Backend has no entry point for investigation
  6. Severity assigned by gut feeling——QA calls it S0, PM calls it S3
  7. Reproduction rate not written——Intermittent treated as 100%, wasting investigation time
  8. Non-reproducible issues immediately closed as Cannot Reproduce— Possibly the real bug was not caught
  9. After the fix, only the original path was tested— Edge cases / similar variants were not covered
  10. Bugs of the same type are not captured as reusable knowledge— The same place will be stumbled on again next time

Supporting templates

  • templates/bug-report-template.md — Complete bug report template (including title / reproduction / severity / impact / verification / self-check)

Collaboration with other skills

上游:
  test-case-design → 用例失败时形成 Bug
  exploratory-testing → Charter 中发现 Bug
  api-testing → 接口测试发现 Bug

下游:
  regression-testing → 转化为回归用例
  test-report → 缺陷分布纳入报告
  field-journal → 同类问题根因沉淀
  开发工作流 → 修复