Creates comprehensive N-dimensional test matrices for codebases. Use when asked to analyze test coverage, identify testing gaps, create test plans, or review what tests exist vs what's needed.
A systematic methodology for analyzing test coverage by modeling the test space as an N-dimensional matrix, mapping existing tests, and identifying gaps.
Before creating the matrix, gather deep context. Run both explorations in parallel using Task agents to save time:
Explore architecture: Use the explore agent to understand:
Explore existing tests: Use the explore agent to catalog:
Identify orthogonal dimensions that define the test space. Common dimensions include:
| Dimension Type | Examples |
|---|---|
| Component Types | Node types, service types, model types |
| Execution Modes | sync, async, generator, streaming |
| Data Structures | Topologies, schemas, relationships |
| Input Variations | Sources, types, edge cases (None, empty, large) |
| Type System | Simple types, generics, unions, protocols |
| Configuration | Feature flags, modes, limits |
| Error Conditions | Validation errors, runtime errors, edge cases |
| External Integrations | APIs, databases, file systems |
For each dimension, enumerate all possible values with descriptions.
Show the theoretical test space size:
Total Combinations = dim1_values Γ dim2_values Γ ... Γ dimN_values
This demonstrates why exhaustive testing is intractable and justifies prioritization.
Instead of testing all combinations, create 2D slices that cover high-value intersections:
For each slice, create a table showing coverage status:
Example slice format:
| Topology | SyncRunner | AsyncRunner |
|----------|:----------:|:-----------:|
| linear | Y | Y |
| diamond | Y | P |
| cycle | Y | N |
**Status**: GOOD - `test_runners/` covers most combinations
**Gap**: Cycle topology with AsyncRunner needs coverage
Create a matrix mapping test files to dimensions:
| Test File | Dim1 | Dim2 | Dim3 | ... |
|---|---|---|---|---|
| test_foo.py | Y | P | N/A | ... |
This reveals which dimensions have good coverage vs gaps.
For each gap, document with concrete test recommendations:
#### GAP-XX: [Descriptive Name]
**Matrix Position**: Dimension1 = value Γ Dimension2 = value
**Risk**: [Why this gap matters]
**Recommended Tests**:
```python
class TestGapName:
def test_specific_scenario(self): ...
def test_edge_case(self): ...
**Focus on intersections, not individual dimensions** - gaps are most dangerous where multiple dimensions combine in untested ways.
Prioritize gaps as HIGH / MEDIUM / LOW based on:
- **Risk**: Likelihood of bugs in this area
- **Impact**: Severity if bugs exist
- **Usage**: How often this code path is used
### Phase 7: Recommendations
Provide actionable output:
1. **Coverage Score**: X/100 with per-dimension breakdown
2. **Top N Action Items**: Prioritized list of gaps to address
3. **New Test Files**: Suggested file names and estimated test counts
4. **Tests to Add to Existing Files**: Specific additions per file
5. **Test Type Distribution**: Current vs recommended (unit, integration, property-based, performance)
## Output Format
Generate a markdown document with these sections:
```markdown
# [Project Name] Test Matrix Review
## Overview
[Brief description of methodology and findings]
## 1. Conceptual Test Matrix (N-Dimensional)
[Tables defining each dimension and its values]
## 2. Full Matrix Combinations
[Calculation showing test space size]
## 3. Prioritized Test Slices
[2D matrices with coverage status]
## 4. Existing Test Coverage Map
[Test file Γ dimension matrix]
## 5. Gap Analysis & Recommended Tests
[Prioritized gaps with specific test recommendations]
## 6. Test Type Distribution
[Current vs recommended distribution]
## 7. Summary
[Coverage score, action items, files to create]
## Appendix: Test Matrix Visualization
[ASCII diagram showing test space structure]