test-coverage
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseWorkflow
工作流程
0. Create Feature Branch
0. 创建功能分支
Before making any changes:
- Check the current branch - if already on a feature branch for this task, skip
- Check the repo for branch naming conventions (e.g., ,
feat/, etc.)feature/ - Create and switch to a new branch following the repo's convention, or fallback to:
feat/test-coverage
在进行任何更改之前:
- 检查当前分支 - 如果已经处于此任务的功能分支上,请跳过
- 检查仓库的分支命名规范(例如:、
feat/等)feature/ - 创建并切换到符合仓库规范的新分支,或者回退使用:
feat/test-coverage
1. Analyze Coverage
1. 分析覆盖率
Run coverage report to identify:
- Untested branches and code paths
- Low-coverage files/functions
- Missing error handling tests
运行覆盖率报告以识别:
- 未测试的分支和代码路径
- 低覆盖率的文件/函数
- 缺失的错误处理测试
2. Identify Test Gaps
2. 识别测试空白
Review code for:
- Logical branches (if/else, switch)
- Error paths and exceptions
- Boundary values (min, max, zero, empty, null)
- Edge cases and corner cases
- State transitions and side effects
检查代码以寻找:
- 逻辑分支(if/else、switch)
- 错误路径和异常
- 边界值(最小值、最大值、零、空值、null)
- 边缘情况和极端场景
- 状态转换和副作用
3. Write Tests
3. 编写测试
Use project's testing framework:
- JavaScript/TypeScript: Jest, Vitest, Mocha
- Python: pytest, unittest
- Go: testing, testify
- Rust: built-in test framework
Target scenarios:
- Error handling and exceptions
- Boundary conditions
- Null/undefined/empty inputs
- Concurrent/async edge cases
使用项目的测试框架:
- JavaScript/TypeScript:Jest、Vitest、Mocha
- Python:pytest、unittest
- Go:testing、testify
- Rust:内置测试框架
针对以下场景:
- 错误处理和异常
- 边界条件
- Null/undefined/空输入
- 并发/异步边缘情况
4. Verify Improvement
4. 验证改进
Run coverage again and confirm measurable increase.
再次运行覆盖率并确认有可衡量的提升。
Guidelines
指导原则
- Follow existing test patterns and naming conventions
- Present new test code blocks only
- Group related test cases logically
- Use descriptive test names that explain the scenario
- 遵循现有的测试模式和命名规范
- 仅展示新的测试代码块
- 按逻辑分组相关测试用例
- 使用能说明场景的描述性测试名称