coverage
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCoverage
测试覆盖率
When to use
使用场景
- You want to check whether recent work is tested well enough
- A file or module looks fragile or under-tested
- You want to add tests without changing behavior
- 你希望检查近期工作的测试是否充分
- 某个文件或模块看起来脆弱或测试不足
- 你希望在不改变代码行为的前提下添加测试
Process
流程
- Choose the target from , current changes, or the latest commit. If there is still no clear target, ask.
$ARGUMENTS - Read the code and the existing tests.
- Identify realistic gaps: edge cases, failure paths, state changes, and integration points.
- Add only the tests that would catch a real bug.
- Run the relevant tests and confirm they pass.
- 从、当前变更或最新提交中选择目标。如果仍无明确目标,请询问。
$ARGUMENTS - 阅读代码和现有测试。
- 识别实际存在的缺口:边缘情况、失败路径、状态变更和集成点。
- 仅添加能发现真实bug的测试。
- 运行相关测试并确认它们通过。
Verification
验证标准
- The target area is clear
- New tests cover real risk, not coverage vanity
- The code under test was not changed
- Tests pass
- 目标范围明确
- 新增测试覆盖真实风险,而非为了提升覆盖率数字而做无用功
- 被测代码未被修改
- 测试全部通过
Rules
规则
- Focus on the smallest set of tests that meaningfully improves confidence.
- Add coverage for contract and failure-path behavior before edge-case trivia.
- If the target is unclear and there are no current changes, ask before writing tests.
- Do not write tests just to raise a number.
- Do not add tests for trivial code or framework behavior.
- If the code is already well-tested, say so.
- 专注于最小范围的测试,以切实提升对代码的信心。
- 优先为契约和失败路径行为补充测试,而非琐碎的边缘情况。
- 如果目标不明确且当前无变更,编写测试前请先询问。
- 不要只为了提高覆盖率数字而编写测试。
- 不要为琐碎代码或框架行为添加测试。
- 如果代码已具备充分测试,请告知。