Test Coverage
Measure, analyze, and report test coverage across all test types, including code coverage, requirement coverage, risk coverage, and quality attribute coverage.
When to use me
Use this skill when:
- Assessing overall test effectiveness
- Identifying coverage gaps in testing strategy
- Reporting test coverage to stakeholders
- Planning test improvement initiatives
- Validating test completeness for releases
- Comparing actual vs planned test coverage
- Tracking coverage trends over time
What I do
Multi-dimensional coverage analysis:
- Code coverage: statements, branches, functions, lines
- Requirement coverage: functional and non-functional requirements
- Risk coverage: high-risk areas and scenarios
- Quality attribute coverage: performance, security, usability, etc.
- User scenario coverage: user journeys and workflows
Coverage measurement:
- Automated coverage collection from test execution
- Manual coverage assessment for exploratory testing
- Integration with test management tools
- Historical coverage trend analysis
Gap analysis and recommendations:
- Identify under-tested areas and components
- Recommend test type mix adjustments
- Suggest coverage improvement strategies
- Prioritize coverage gaps based on risk
Reporting and visualization:
- Generate coverage reports for different stakeholders
- Create coverage dashboards and visualizations
- Track coverage against targets and benchmarks
- Provide coverage insights for decision making
Coverage Dimensions
- Code Coverage: What code is executed by tests?
- Requirement Coverage: What requirements are validated by tests?
- Risk Coverage: What risks are mitigated by tests?
- Scenario Coverage: What user scenarios are tested?
- Data Coverage: What data variations are tested?
- Configuration Coverage: What configurations are tested?
Examples
# Measure overall test coverage
npm run test:coverage:measure # Comprehensive coverage measurement
npm run test:coverage:report # Generate coverage report
# Specific coverage types
npm run test:coverage:code # Code coverage analysis
npm run test:coverage:requirements # Requirement coverage analysis
npm run test:coverage:risks # Risk coverage analysis
npm run test:coverage:scenarios # Scenario coverage analysis
npm run test:coverage:data # Data coverage analysis
# Integration with test types
npm run test:coverage -- --include unit,integration,e2e
npm run test:coverage -- --exclude performance,security
npm run test:coverage -- --type functional
npm run test:coverage -- --type nonfunctional
# Coverage visualization
npm run test:coverage:visualize # Generate coverage visualizations
npm run test:coverage:dashboard # Coverage dashboard
npm run test:coverage:trends # Coverage trend analysis
# Coverage targets
npm run test:coverage:targets # Check against coverage targets
npm run test:coverage:gaps # Identify coverage gaps
Output format
Test Coverage Analysis Report
──────────────────────────────
Project: Customer Portal v1.3
Analysis Period: Last 30 days
Test Types Included: 8 of 12
Overall Coverage Summary:
- Code Coverage: 78% (target: 80%)
- Requirement Coverage: 92% (target: 95%)
- Risk Coverage: 85% (target: 90%)
- Scenario Coverage: 88% (target: 85% ✓)
- Quality Attribute Coverage: 72% (target: 75%)
Code Coverage Detail:
- Statements: 82% (45,210/55,134)
- Branches: 71% (12,345/17,390)
- Functions: 85% (3,456/4,067)
- Lines: 80% (38,765/48,456)
By Test Type Contribution:
Unit Tests:
- Code Coverage: 65% primary contributor
- Fastest feedback, highest volume
Integration Tests:
- Code Coverage: +12% incremental
- API and database coverage
E2E Tests:
- Code Coverage: +1% incremental
- User journey coverage
Security Tests:
- Requirement Coverage: +15% security requirements
- No code coverage contribution
Requirement Coverage:
Functional Requirements: 145/150 (97%)
- Missing: FR-23 (reporting export), FR-45 (bulk update)
Non-Functional Requirements: 28/35 (80%)
- Missing: NFR-12 (concurrent users), NFR-18 (data retention)
Risk Coverage:
High Risks: 8/10 covered (80%)
- Uncovered: R-05 (payment failure), R-09 (data corruption)
Medium Risks: 22/25 covered (88%)
Low Risks: 45/50 covered (90%)
Scenario Coverage:
User Journeys: 15/18 covered (83%)
- Uncovered: Guest checkout, Account deletion
Business Processes: 8/10 covered (80%)
Admin Flows: 6/8 covered (75%)
Coverage by Component:
- Authentication: 95% (excellent)
- User Management: 88% (good)
- Billing: 65% (needs improvement)
- Reporting: 45% (poor)
- API Gateway: 92% (good)
Coverage Gaps Analysis:
Critical Gaps:
1. Billing module has low test automation
2. Reporting features largely untested
3. Payment failure scenarios not covered
Moderate Gaps:
1. Admin flows need more test coverage
2. Edge cases in user management
Minor Gaps:
1. Some utility functions untested
2. Legacy code with no recent test updates
Test Type Effectiveness:
- Most Effective: Unit tests (high coverage, fast)
- Best for Risk Coverage: Integration tests
- Best for User Confidence: E2E tests
- Most Impactful for Quality: Security & performance tests
Recommendations:
1. Increase unit test coverage in billing module to 80%
2. Add integration tests for reporting functionality
3. Implement security tests for payment processing
4. Create E2E tests for guest checkout scenario
5. Review and update test targets for next quarter
Trend Analysis:
- Code coverage increased from 72% to 78% this quarter
- Requirement coverage stable at 92%
- Risk coverage improved from 80% to 85%
- Positive trend overall, but billing module declining
Notes
- Coverage metrics should inform, not drive, testing decisions
- Different coverage types matter for different contexts
- High coverage doesn't guarantee high quality, but low coverage often indicates risk
- Balance coverage metrics with other quality indicators
- Use coverage data to guide test improvement, not as a punitive measure
- Consider coverage context (legacy code vs new development)
- Automate coverage collection where possible
- Review coverage regularly, not just before releases
- Share coverage insights with development teams
- Use coverage as one input among many for quality assessment
1---2name: test-coverage3description: Measure and report test coverage across all test types4license: MIT5---67# Test Coverage89Measure, analyze, and report test coverage across all test types, including code coverage, requirement coverage, risk coverage, and quality attribute coverage.1011## When to use me1213Use this skill when:14- Assessing overall test effectiveness15- Identifying coverage gaps in testing strategy16- Reporting test coverage to stakeholders17- Planning test improvement initiatives18- Validating test completeness for releases19- Comparing actual vs planned test coverage20- Tracking coverage trends over time2122## What I do2324- **Multi-dimensional coverage analysis**:25 - Code coverage: statements, branches, functions, lines26 - Requirement coverage: functional and non-functional requirements27 - Risk coverage: high-risk areas and scenarios28 - Quality attribute coverage: performance, security, usability, etc.29 - User scenario coverage: user journeys and workflows3031- **Coverage measurement**:32 - Automated coverage collection from test execution33 - Manual coverage assessment for exploratory testing34 - Integration with test management tools35 - Historical coverage trend analysis3637- **Gap analysis and recommendations**:38 - Identify under-tested areas and components39 - Recommend test type mix adjustments40 - Suggest coverage improvement strategies41 - Prioritize coverage gaps based on risk4243- **Reporting and visualization**:44 - Generate coverage reports for different stakeholders45 - Create coverage dashboards and visualizations46 - Track coverage against targets and benchmarks47 - Provide coverage insights for decision making4849## Coverage Dimensions50511. **Code Coverage**: What code is executed by tests?522. **Requirement Coverage**: What requirements are validated by tests?533. **Risk Coverage**: What risks are mitigated by tests?544. **Scenario Coverage**: What user scenarios are tested?555. **Data Coverage**: What data variations are tested?566. **Configuration Coverage**: What configurations are tested?5758## Examples5960```bash61# Measure overall test coverage62npm run test:coverage:measure # Comprehensive coverage measurement63npm run test:coverage:report # Generate coverage report6465# Specific coverage types66npm run test:coverage:code # Code coverage analysis67npm run test:coverage:requirements # Requirement coverage analysis68npm run test:coverage:risks # Risk coverage analysis69npm run test:coverage:scenarios # Scenario coverage analysis70npm run test:coverage:data # Data coverage analysis7172# Integration with test types73npm run test:coverage -- --include unit,integration,e2e74npm run test:coverage -- --exclude performance,security75npm run test:coverage -- --type functional76npm run test:coverage -- --type nonfunctional7778# Coverage visualization79npm run test:coverage:visualize # Generate coverage visualizations80npm run test:coverage:dashboard # Coverage dashboard81npm run test:coverage:trends # Coverage trend analysis8283# Coverage targets84npm run test:coverage:targets # Check against coverage targets85npm run test:coverage:gaps # Identify coverage gaps86```8788## Output format8990```91Test Coverage Analysis Report92──────────────────────────────93Project: Customer Portal v1.394Analysis Period: Last 30 days95Test Types Included: 8 of 129697Overall Coverage Summary:98 - Code Coverage: 78% (target: 80%)99 - Requirement Coverage: 92% (target: 95%)100 - Risk Coverage: 85% (target: 90%)101 - Scenario Coverage: 88% (target: 85% ✓)102 - Quality Attribute Coverage: 72% (target: 75%)103104Code Coverage Detail:105 - Statements: 82% (45,210/55,134)106 - Branches: 71% (12,345/17,390)107 - Functions: 85% (3,456/4,067)108 - Lines: 80% (38,765/48,456)109110By Test Type Contribution:111 Unit Tests:112 - Code Coverage: 65% primary contributor113 - Fastest feedback, highest volume114 115 Integration Tests:116 - Code Coverage: +12% incremental117 - API and database coverage118 119 E2E Tests:120 - Code Coverage: +1% incremental 121 - User journey coverage122 123 Security Tests:124 - Requirement Coverage: +15% security requirements125 - No code coverage contribution126127Requirement Coverage:128 Functional Requirements: 145/150 (97%)129 - Missing: FR-23 (reporting export), FR-45 (bulk update)130 131 Non-Functional Requirements: 28/35 (80%)132 - Missing: NFR-12 (concurrent users), NFR-18 (data retention)133134Risk Coverage:135 High Risks: 8/10 covered (80%)136 - Uncovered: R-05 (payment failure), R-09 (data corruption)137 138 Medium Risks: 22/25 covered (88%)139 Low Risks: 45/50 covered (90%)140141Scenario Coverage:142 User Journeys: 15/18 covered (83%)143 - Uncovered: Guest checkout, Account deletion144 145 Business Processes: 8/10 covered (80%)146 Admin Flows: 6/8 covered (75%)147148Coverage by Component:149 - Authentication: 95% (excellent)150 - User Management: 88% (good)151 - Billing: 65% (needs improvement)152 - Reporting: 45% (poor)153 - API Gateway: 92% (good)154155Coverage Gaps Analysis:156 Critical Gaps:157 1. Billing module has low test automation158 2. Reporting features largely untested159 3. Payment failure scenarios not covered160 161 Moderate Gaps:162 1. Admin flows need more test coverage163 2. Edge cases in user management164 165 Minor Gaps:166 1. Some utility functions untested167 2. Legacy code with no recent test updates168169Test Type Effectiveness:170 - Most Effective: Unit tests (high coverage, fast)171 - Best for Risk Coverage: Integration tests172 - Best for User Confidence: E2E tests173 - Most Impactful for Quality: Security & performance tests174175Recommendations:176 1. Increase unit test coverage in billing module to 80%177 2. Add integration tests for reporting functionality178 3. Implement security tests for payment processing179 4. Create E2E tests for guest checkout scenario180 5. Review and update test targets for next quarter181182Trend Analysis:183 - Code coverage increased from 72% to 78% this quarter184 - Requirement coverage stable at 92%185 - Risk coverage improved from 80% to 85%186 - Positive trend overall, but billing module declining187```188189## Notes190191- Coverage metrics should inform, not drive, testing decisions192- Different coverage types matter for different contexts193- High coverage doesn't guarantee high quality, but low coverage often indicates risk194- Balance coverage metrics with other quality indicators195- Use coverage data to guide test improvement, not as a punitive measure196- Consider coverage context (legacy code vs new development)197- Automate coverage collection where possible198- Review coverage regularly, not just before releases199- Share coverage insights with development teams200- Use coverage as one input among many for quality assessment