test-gap-analyzer

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Test Gap Analyzer Skill

测试缺口分析Skill

Purpose

用途

This skill automatically analyzes codebases to identify untested functions, low coverage areas, and missing edge case tests. It generates actionable test suggestions organized by priority and risk impact, following amplihack's testing pyramid (60% unit, 30% integration, 10% E2E).
该Skill可自动分析代码库,识别未测试的函数、低覆盖率区域以及缺失的边缘情况测试。它会根据风险影响和优先级生成可执行的测试建议,并遵循amplihack的测试金字塔(60%单元测试、30%集成测试、10% E2E测试)进行组织。

When to Use This Skill

何时使用该Skill

  • Code review: Before merging PRs, identify test gaps
  • Test planning: Prioritize what to test next based on risk
  • Coverage improvement: Target low-coverage areas systematically
  • Edge case discovery: Find untested failure modes and boundaries
  • New modules: Ensure comprehensive test coverage before release
  • Legacy code: Incrementally improve test coverage
  • Refactoring: Verify coverage before and after changes
  • 代码评审:合并PRs前,识别测试缺口
  • 测试规划:根据风险优先确定下一步测试内容
  • 覆盖率提升:系统性地针对低覆盖率区域
  • 边缘情况发现:找出未测试的故障模式和边界
  • 新模块:发布前确保全面的测试覆盖
  • 遗留代码:逐步提升测试覆盖率
  • 重构:变更前后验证覆盖率

Core Concepts

核心概念

Testing Pyramid in Amplihack

Amplihack中的测试金字塔

Tests should follow this distribution:
  • 60% Unit Tests: Individual function/method behavior with mocked dependencies
  • 30% Integration Tests: Multiple components working together
  • 10% E2E Tests: Full user workflows end-to-end
This skill helps balance tests across these layers while prioritizing coverage.
测试应遵循以下分布:
  • 60% 单元测试:独立函数/方法的行为测试,依赖项使用Mock
  • 30% 集成测试:多个组件协同工作的测试
  • 10% E2E测试:完整用户工作流的端到端测试
该Skill有助于在这些层级间平衡测试,同时优先保障覆盖率。

Gap Analysis Categories

缺口分析类别

The skill identifies gaps in these areas:
  1. Untested Functions/Methods: Functions with zero test coverage
  2. Low Coverage Areas: Modules/functions below target threshold (85%+)
  3. Missing Edge Cases: Boundary conditions, error paths, null checks
  4. Integration Gaps: Component interactions not tested
  5. Error Path Coverage: Exception handling and failure modes
该Skill识别以下领域的缺口:
  1. 未测试的函数/方法:零测试覆盖率的函数
  2. 低覆盖率区域:低于目标阈值(85%+)的模块/函数
  3. 缺失的边缘情况:边界条件、错误路径、空值检查
  4. 集成缺口:未测试的组件交互
  5. 错误路径覆盖率:异常处理和故障模式

Analysis Process

分析流程

Step 1: Codebase Scanning

步骤1:代码库扫描

The analyzer:
  1. Discovers all source code files in specified directory
  2. Identifies all functions, methods, and classes
  3. Maps code structure and dependencies
  4. Determines current test coverage (if available)
分析器会:
  1. 发现指定目录下的所有源代码文件
  2. 识别所有函数、方法和类
  3. 映射代码结构和依赖关系
  4. 确定当前测试覆盖率(若可用)

Step 2: Coverage Analysis

步骤2:覆盖率分析

For each function/method:
  1. Check if tests exist
  2. Calculate line coverage if coverage data available
  3. Identify untested branches and paths
  4. Note error handling coverage
针对每个函数/方法:
  1. 检查是否存在测试
  2. 若有覆盖率数据则计算行覆盖率
  3. 识别未测试的分支和路径
  4. 记录错误处理的覆盖情况

Step 3: Gap Identification

步骤3:缺口识别

Classify gaps by:
  1. Risk Level: High/Medium/Low based on function complexity and criticality
  2. Type: Untested, partial coverage, missing edge cases
  3. Effort: Estimate time to write adequate tests
  4. Impact: How important this function is to system reliability
按以下维度对缺口进行分类:
  1. 风险等级:根据函数复杂度和关键性分为高/中/低
  2. 类型:未测试、部分覆盖、缺失边缘情况
  3. 工作量:估算编写充分测试所需的时间
  4. 影响:该函数对系统可靠性的重要程度

Step 4: Test Suggestion Generation

步骤4:测试建议生成

For each gap, generate:
  1. Specific test case descriptions
  2. Test templates with example code
  3. Edge cases to cover
  4. Expected behaviors
  5. Error conditions to test
针对每个缺口,生成:
  1. 具体的测试用例描述
  2. 带示例代码的测试模板
  3. 需要覆盖的边缘情况
  4. 预期行为
  5. 需要测试的错误条件

Step 5: Prioritization

步骤5:优先级排序

Organize suggestions by:
  1. Risk impact (critical functions first)
  2. Test pyramid distribution
  3. Effort required
  4. Dependency relationships
按以下顺序组织建议:
  1. 风险影响(关键函数优先)
  2. 测试金字塔分布
  3. 所需工作量
  4. 依赖关系

Skill Capabilities

Skill能力

Code Analysis

代码分析

  • Scans Python, JavaScript, TypeScript, Go codebases
  • Identifies all public and private functions
  • Detects complex functions needing more tests
  • Maps function dependencies
  • Finds unused parameters and dead code paths
  • 扫描Python、JavaScript、TypeScript、Go代码库
  • 识别所有公共和私有函数
  • 检测需要更多测试的复杂函数
  • 映射函数依赖关系
  • 发现未使用的参数和死代码路径

Coverage Detection

覆盖率检测

  • Parses
    .coverage
    files (Python)
  • Analyzes coverage.json reports
  • Identifies uncovered branches
  • Finds partially tested functions
  • Detects coverage threshold violations
  • 解析
    .coverage
    文件(Python)
  • 分析coverage.json报告
  • 识别未覆盖的分支
  • 发现部分测试的函数
  • 检测覆盖率阈值违规情况

Test Gap Discovery

测试缺口发现

  • Functions with zero tests
  • Branches never executed
  • Error paths untested
  • Boundary conditions missed
  • Integration points not covered
  • Timeout scenarios missing
  • Resource exhaustion cases
  • 零测试的函数
  • 从未执行的分支
  • 未测试的错误路径
  • 遗漏的边界条件
  • 未覆盖的集成点
  • 缺失的超时场景
  • 资源耗尽情况

Edge Case Identification

边缘情况识别

  • Null/None inputs
  • Empty collections
  • Boundary values (0, max_int, etc.)
  • Unicode/multibyte strings
  • Concurrency issues
  • Resource limits
  • Type mismatches
  • Async/await patterns
  • Null/None输入
  • 空集合
  • 边界值(0、max_int等)
  • Unicode/多字节字符串
  • 并发问题
  • 资源限制
  • 类型不匹配
  • Async/await模式

Test Template Generation

测试模板生成

Provides ready-to-use test templates for:
  • Unit tests (mocked dependencies)
  • Integration tests (real components)
  • E2E tests (full workflows)
  • Parametrized tests
  • Property-based tests
  • Performance tests
提供可直接使用的测试模板,适用于:
  • 单元测试(Mock依赖项)
  • 集成测试(真实组件)
  • E2E测试(完整工作流)
  • 参数化测试
  • 属性化测试
  • 性能测试

Usage Examples

使用示例

Example 1: Analyze Python Project

示例1:分析Python项目

User: Analyze test coverage gaps in my src/ directory

Claude:
1. Scans src/ for all Python files
2. Reads .coverage or uses ast analysis
3. Identifies untested functions
4. Generates gap report with suggestions

Output:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Test Gap Analysis Report
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Summary:
- Total functions: 145
- Untested: 23 (16%)
- Low coverage (< 85%): 34 (23%)

CRITICAL GAPS (High Risk):
1. payment_processor.py::process_payment()
   - Untested | Handles money | 15 min effort
   - Suggested tests:
     - Valid payment processing
     - Insufficient funds error
     - Payment timeout
     - Currency conversion

MEDIUM GAPS:
2. user_service.py::validate_email()
   - 40% coverage | Missing edge cases
   - Suggested tests:
     - Unicode characters
     - Long email addresses
     - Special characters

LOW GAPS:
3. utils.py::format_date()
   - 60% coverage
   - Suggested tests:
     - Timezone handling
     - Daylight saving transitions
用户:分析我src/目录下的测试覆盖率缺口

Claude:
1. 扫描src/下的所有Python文件
2. 读取.coverage文件或使用AST分析
3. 识别未测试的函数
4. 生成带建议的缺口报告

输出:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
测试缺口分析报告
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

摘要:
- 总函数数:145
- 未测试:23个(16%)
- 低覆盖率(<85%):34个(23%)

关键缺口(高风险):
1. payment_processor.py::process_payment()
   - 未测试 | 处理资金 | 15分钟工作量
   - 建议测试:
     - 有效支付处理
     - 资金不足错误
     - 支付超时
     - 货币转换

中等缺口:
2. user_service.py::validate_email()
   - 40%覆盖率 | 缺失边缘情况
   - 建议测试:
     - Unicode字符
     - 长邮箱地址
     - 特殊字符

低优先级缺口:
3. utils.py::format_date()
   - 60%覆盖率
   - 建议测试:
     - 时区处理
     - 夏令时转换

Example 2: Get Test Templates

示例2:获取测试模板

User: Generate test templates for my untested auth module

Claude:
Creates templates organized by testing pyramid:

Unit Tests (60%):
- test_token_validation_valid()
- test_token_validation_expired()
- test_token_validation_invalid_signature()

Integration Tests (30%):
- test_auth_flow_with_database()
- test_multi_user_concurrent_auth()

E2E Tests (10%):
- test_user_login_to_protected_resource()
- test_session_persistence_across_requests()
用户:为我未测试的auth模块生成测试模板

Claude:
按测试金字塔组织生成模板:

单元测试(60%):
- test_token_validation_valid()
- test_token_validation_expired()
- test_token_validation_invalid_signature()

集成测试(30%):
- test_auth_flow_with_database()
- test_multi_user_concurrent_auth()

E2E测试(10%):
- test_user_login_to_protected_resource()
- test_session_persistence_across_requests()

Example 3: Coverage Improvement Plan

示例3:覆盖率提升计划

User: Help me improve test coverage from 65% to 85%

Claude:
1. Analyzes current coverage
2. Identifies gaps blocking 85% threshold
3. Prioritizes by impact
4. Estimates effort

Output:
To reach 85% coverage:
- 12 quick wins (< 2 hours each)
- 3 medium tasks (2-4 hours each)
- 2 complex tasks (4+ hours each)

Recommended order:
1. Add error case tests (5 tests, 3 hours) -> +8%
2. Cover auth edge cases (8 tests, 4 hours) -> +6%
3. Add integration tests (12 tests, 6 hours) -> +7%
用户:帮我将测试覆盖率从65%提升到85%

Claude:
1. 分析当前覆盖率
2. 识别阻碍达到85%阈值的缺口
3. 按影响优先级排序
4. 估算工作量

输出:
要达到85%覆盖率:
- 12个快速任务(每个<2小时)
- 3个中等任务(2-4小时)
- 2个复杂任务(4+小时)

推荐顺序:
1. 添加错误用例测试(5个测试,3小时)→ +8%
2. 覆盖auth边缘情况(8个测试,4小时)→ +6%
3. 添加集成测试(12个测试,6小时)→ +7%

Analysis Checklist

分析检查清单

Coverage Inspection

覆盖率检查

  • Identify all source files in target directory
  • Determine current coverage percentage
  • Find all untested functions
  • Locate functions below 85% coverage
  • Map branch coverage gaps
  • 识别目标目录下的所有源文件
  • 确定当前覆盖率百分比
  • 找出所有未测试的函数
  • 定位覆盖率低于85%的函数
  • 映射分支覆盖率缺口

Gap Classification

缺口分类

  • Categorize by risk level (high/med/low)
  • Estimate effort for each gap
  • Identify critical path functions
  • Find dependency relationships
  • Prioritize by impact
  • 按风险等级(高/中/低)分类
  • 估算每个缺口的工作量
  • 识别关键路径函数
  • 发现依赖关系
  • 按影响优先级排序

Test Suggestion Generation

测试建议生成

  • Generate unit test templates
  • Generate integration test templates
  • Suggest edge cases
  • Provide error scenario tests
  • Include parametrized test examples
  • 生成单元测试模板
  • 生成集成测试模板
  • 建议边缘情况
  • 提供错误场景测试
  • 包含参数化测试示例

Report Generation

报告生成

  • Summary statistics
  • Gap listing by priority
  • Test templates for each gap
  • Estimated effort total
  • Recommended testing order
  • 摘要统计
  • 按优先级列出缺口
  • 每个缺口对应的测试模板
  • 总工作量估算
  • 推荐测试顺序

Output Format

输出格式

Standard Report Structure

标准报告结构

markdown
undefined
markdown
undefined

Test Gap Analysis Report

测试缺口分析报告

Summary

摘要

  • Total functions: N
  • Untested functions: N (X%)
  • Functions < 85%: N (X%)
  • Average coverage: X%
  • 总函数数:N
  • 未测试函数数:N(X%)
  • 覆盖率<85%的函数数:N(X%)
  • 平均覆盖率:X%

Critical Gaps (Must Test)

关键缺口(必须测试)

  1. Function name | Type | Priority | Effort Suggested tests: [list]
  1. 函数名称 | 类型 | 优先级 | 工作量 建议测试:[列表]

Medium Priority Gaps

中等优先级缺口

[Similar structure]
[类似结构]

Low Priority Gaps

低优先级缺口

[Similar structure]
[类似结构]

Testing Pyramid Distribution

测试金字塔分布

Current:
  • Unit: X% | Target: 60%
  • Integration: X% | Target: 30%
  • E2E: X% | Target: 10%
当前:
  • 单元测试:X% | 目标:60%
  • 集成测试:X% | 目标:30%
  • E2E测试:X% | 目标:10%

Test Templates

测试模板

[Ready-to-use test code]
[可直接使用的测试代码]

Effort Estimate

工作量估算

  • Quick wins: N hours
  • Medium tasks: N hours
  • Complex work: N hours
  • Total: N hours
undefined
  • 快速任务:N小时
  • 中等任务:N小时
  • 复杂工作:N小时
  • 总计:N小时
undefined

Test Template Examples

测试模板示例

Unit Test Template

单元测试模板

python
def test_function_name_happy_path():
    """Test function with valid inputs."""
    # Arrange
    input_data = {...}
    expected = {...}

    # Act
    result = function_name(input_data)

    # Assert
    assert result == expected
python
def test_function_name_happy_path():
    """测试函数的正常输入场景。"""
    # 准备
    input_data = {...}
    expected = {...}

    # 执行
    result = function_name(input_data)

    # 断言
    assert result == expected

Error Case Template

错误场景模板

python
def test_function_name_invalid_input():
    """Test function raises ValueError on invalid input."""
    with pytest.raises(ValueError, match="Expected error message"):
        function_name(invalid_input)
python
def test_function_name_invalid_input():
    """测试函数在输入无效时抛出ValueError。"""
    with pytest.raises(ValueError, match="预期错误信息"):
        function_name(invalid_input)

Edge Case Template

边缘情况模板

python
def test_function_name_edge_case():
    """Test function handles edge case correctly."""
    # Test boundary conditions
    result = function_name(boundary_value)
    assert result is not None
python
def test_function_name_edge_case():
    """测试函数正确处理边缘情况。"""
    # 测试边界条件
    result = function_name(boundary_value)
    assert result is not None

Integration Test Template

集成测试模板

python
def test_user_service_with_database(test_db):
    """Test user service with real database."""
    user_service = UserService(test_db)
    user = user_service.create_user("test@example.com")
    assert user.id is not None
python
def test_user_service_with_database(test_db):
    """测试用户服务与真实数据库的集成。"""
    user_service = UserService(test_db)
    user = user_service.create_user("test@example.com")
    assert user.id is not None

Philosophy Alignment

理念对齐

Ruthless Simplicity

极致简洁

  • Focus on essential tests, not comprehensive coverage
  • 85% coverage is sufficient (diminishing returns beyond)
  • Avoid testing implementation details
  • Test behavior, not code structure
  • 聚焦必要测试,而非全面覆盖
  • 85%覆盖率已足够(超过后收益递减)
  • 避免测试实现细节
  • 测试行为,而非代码结构

Zero-BS Implementation

零冗余实现

  • All test templates work out of the box
  • No placeholder tests or TODO comments
  • Tests provide real value
  • Edge cases are specific, not generic
  • 所有测试模板均可直接使用
  • 无占位测试或TODO注释
  • 测试提供实际价值
  • 边缘情况具体明确,而非泛泛而谈

Testing Pyramid

测试金字塔

  • Prioritize unit tests (fast, isolated)
  • Add integration tests (verify contracts)
  • Minimal E2E tests (verify user flows)
  • Balanced distribution prevents brittleness
  • 优先单元测试(快速、隔离)
  • 补充集成测试(验证契约)
  • 最少E2E测试(验证用户流程)
  • 均衡分布可避免测试脆弱性

Integration with Other Skills

与其他Skill的集成

Works With

可协同使用

  • code-quality-analyzer: Identifies complexity
  • module-spec-generator: Aligns tests with specs
  • refactor-advisor: Plans test changes
  • type-safety-checker: Tests type contracts
  • code-quality-analyzer:识别复杂度
  • module-spec-generator:使测试与规范对齐
  • refactor-advisor:规划测试变更
  • type-safety-checker:测试类型契约

Feeds Into

输出可用于

  • CI Validation: Ensures tests pass before merge
  • Documentation: Demonstrates module usage
  • Regression Prevention: Protects against regressions
  • CI验证:确保合并前测试通过
  • 文档:展示模块用法
  • 回归预防:防止回归问题

Common Patterns

常见模式

Pattern 1: Fast Gap Discovery

模式1:快速缺口发现

User: Quick test coverage review of api/

Claude:
- Scans directory
- Identifies top 5 gaps
- Provides quick recommendations
- Total time: < 2 minutes
用户:快速评审api/目录的测试覆盖率

Claude:
- 扫描目录
- 识别前5个缺口
- 提供快速建议
- 总耗时:<2分钟

Pattern 2: Systematic Coverage Improvement

模式2:系统性覆盖率提升

User: Plan test coverage improvement from 60% to 85%

Claude:
- Analyzes gaps
- Creates phased improvement plan
- Prioritizes by risk
- Provides effort estimates
- Generates all test templates
用户:规划将测试覆盖率从60%提升到85%

Claude:
- 分析缺口
- 创建分阶段提升计划
- 按风险优先级排序
- 提供工作量估算
- 生成所有测试模板

Pattern 3: New Module Test Planning

模式3:新模块测试规划

User: Generate complete test plan for new auth module

Claude:
- Analyzes module structure
- Maps public functions
- Creates test suggestions
- Balances testing pyramid
- Provides all templates
用户:为新的auth模块生成完整测试计划

Claude:
- 分析模块结构
- 映射公共函数
- 创建测试建议
- 平衡测试金字塔
- 提供所有模板

Quality Checks

质量检查

After analysis, verify:
  • Gap identification is accurate
  • Test templates are ready to use
  • Effort estimates are realistic
  • Prioritization follows risk analysis
  • Testing pyramid is balanced
  • Edge cases are specific, not generic
  • Integration points are identified
  • Error paths are covered
分析完成后,验证以下内容:
  • 缺口识别准确
  • 测试模板可直接使用
  • 工作量估算合理
  • 优先级排序遵循风险分析
  • 测试金字塔均衡
  • 边缘情况具体明确,而非泛泛而谈
  • 集成点已识别
  • 错误路径已覆盖

Common Pitfalls to Avoid

需避免的常见陷阱

❌ Over-Testing Implementation

❌ 过度测试实现细节

Test behavior, not how the code works. Details can change.
测试行为,而非代码的工作方式。细节可能会变化。

❌ Generic Edge Cases

❌ 泛泛的边缘情况

Be specific: "Test empty string" not "Test edge cases"
要具体:比如"测试空字符串"而非"测试边缘情况"

❌ Ignoring Integration

❌ 忽略集成测试

Don't just test functions in isolation. Test how they work together.
不要仅孤立测试函数,还要测试它们协同工作的方式。

❌ Missing Error Paths

❌ 遗漏错误路径

Every error condition should have at least one test.
每个错误条件都应至少有一个测试。

❌ Untested Dependencies

❌ 未测试依赖项

Mock external systems, but test the integration points.
Mock外部系统,但要测试集成点。

Success Criteria

成功标准

A good test gap analysis:
  • Identifies all untested functions
  • Prioritizes by risk and impact
  • Provides ready-to-use test templates
  • Balances testing pyramid
  • Estimates effort realistically
  • Includes edge case suggestions
  • Maps integration gaps
  • Provides actionable recommendations
一份优质的测试缺口分析应:
  • 识别所有未测试的函数
  • 按风险和影响优先级排序
  • 提供可直接使用的测试模板
  • 平衡测试金字塔
  • 工作量估算合理
  • 包含边缘情况建议
  • 映射集成缺口
  • 提供可执行的建议

Tips for Effective Test Planning

有效测试规划技巧

  1. Start with critical functions: Money, security, data integrity
  2. Use test templates: Don't write from scratch
  3. Balance the pyramid: Don't over-test edge cases
  4. Test contracts, not implementations: Behavior matters, details don't
  5. Include happy path and error cases: Both are important
  6. Automate coverage tracking: Catch regressions early
  7. Iterative improvement: 85% coverage is realistic, 100% is overkill
  8. Document why tests exist: Future maintainers should understand intent
  1. 从关键函数开始:资金、安全、数据完整性相关函数
  2. 使用测试模板:不要从零开始编写
  3. 平衡测试金字塔:不要过度测试边缘情况
  4. 测试契约,而非实现:行为才重要,细节不重要
  5. 包含正常路径和错误路径:两者都很重要
  6. 自动化覆盖率跟踪:尽早发现回归问题
  7. 迭代改进:85%覆盖率是现实目标,100%属于过度测试
  8. 记录测试的存在原因:未来维护者应理解测试意图

Tools and Commands

工具与命令

For Python Projects

针对Python项目

bash
undefined
bash
undefined

Generate coverage report

生成覆盖率报告

coverage run -m pytest coverage json # Creates coverage.json
coverage run -m pytest coverage json # 创建coverage.json

Analyze gaps with this skill

使用该Skill分析缺口

Claude: Analyze test gaps in my project using coverage.json
undefined
Claude: 使用coverage.json分析我的项目测试缺口
undefined

For TypeScript/JavaScript

针对TypeScript/JavaScript

bash
undefined
bash
undefined

Generate coverage report

生成覆盖率报告

jest --coverage
jest --coverage

Analyze gaps

分析缺口

Claude: Analyze test gaps in my TypeScript project
undefined
Claude: 分析我的TypeScript项目测试缺口
undefined

Real-World Example

真实世界示例

Before Analysis

分析前

Project Stats:
- 156 functions
- 52% test coverage
- Unknown untested functions
- Scattered test files
项目统计:
- 156个函数
- 52%测试覆盖率
- 未知的未测试函数
- 分散的测试文件

After Analysis

分析后

Gap Report:
- 24 untested functions (15%)
- 34 functions < 85% (22%)
- 12 critical gaps (high impact)
- 45 medium gaps (medium impact)
- 40 low gaps (low priority)

Recommendations:
1. Focus on critical gaps (payment, auth, data)
2. Add error case tests (20 tests, 8 hours)
3. Cover edge cases (15 tests, 6 hours)
4. Integration tests (12 tests, 10 hours)

Result after implementing:
- 89% test coverage
- All critical functions tested
- Balanced testing pyramid
- Improved confidence in refactoring
缺口报告:
- 24个未测试函数(15%)
- 34个覆盖率<85%的函数(22%)
- 12个关键缺口(高影响)
- 45个中等缺口(中影响)
- 40个低优先级缺口(低影响)

建议:
1. 聚焦关键缺口(支付、认证、数据相关)
2. 添加错误用例测试(20个测试,8小时)
3. 覆盖边缘情况(15个测试,6小时)
4. 集成测试(12个测试,10小时)

实施后结果:
- 89%测试覆盖率
- 所有关键函数均已测试
- 测试金字塔均衡
- 重构信心提升

Next Steps

后续步骤

After gap analysis:
  1. Review Report: Understand current state
  2. Prioritize Gaps: Focus on critical functions first
  3. Use Templates: Implement suggested tests
  4. Run Tests: Verify new tests pass
  5. Track Coverage: Monitor improvement
  6. Iterate: Gradually increase coverage
完成缺口分析后:
  1. 评审报告:了解当前状态
  2. 优先级排序缺口:先聚焦关键函数
  3. 使用模板:实现建议的测试
  4. 运行测试:验证新测试通过
  5. 跟踪覆盖率:监控改进情况
  6. 迭代:逐步提升覆盖率

Success Metrics

成功指标

Effective test gap analysis results in:
  • Clear picture of coverage status
  • Actionable improvement plan
  • 85%+ test coverage achieved
  • Balanced testing pyramid
  • Improved developer confidence
  • Faster debugging and refactoring
  • Fewer production issues
有效的测试缺口分析会带来以下结果:
  • 清晰了解覆盖率状态
  • 可执行的改进计划
  • 达到85%+的测试覆盖率
  • 均衡的测试金字塔
  • 提升开发者信心
  • 更快的调试和重构
  • 更少的生产环境问题