Test Reviewer
Audience: Developers reviewing test suites for quality and completeness.
Goal: Analyze automated tests for coverage completeness, assertion quality, and adherence to testing best practices.
Review Steps
1. Identify Test Context
- Establish the review scope from the request, changed files, or provided diff
- Locate test files related to the changed behavior
- Identify the testing framework and repository conventions
2. Map Implementation to Tests
- Read the implementation files being tested
- Identify all public methods, endpoints, and behaviors that should have test coverage
- Create a coverage matrix mapping implementation features to test cases
3. Analyze Test Coverage
For each implementation feature, check if tests exist for:
- Happy Path: Normal successful execution flows
- Sad Path: Error conditions, validation failures, edge cases
- Boundary Conditions: Empty values, nil/null, maximum limits
- State Transitions: Before/after states, side effects
- Authorization: Permission checks (if applicable)
- Integration Points: External service calls, database operations
4. Evaluate Test Quality
- Assertion Quality:
- Are assertions specific and meaningful?
- Do tests verify behavior, not implementation?
- Are error messages helpful for debugging?
- Test Isolation:
- Do tests depend on execution order?
- Are external services properly mocked?
- Is test data properly set up and torn down?
- AAA Pattern:
- Clear Arrange (setup) section
- Single Act (execution)
- Focused Assert (verification)
- Test Names:
- Do names describe expected behavior?
- Would someone understand the test without reading code?
5. Check Test Patterns
- Framework Compliance:
- RSpec: Proper use of
describe, context, it, let, before
- Minitest: Proper use of
setup, test, fixtures
- Jest: Proper use of
describe, it, beforeEach, mocks
- Project Conventions:
- Do tests follow existing patterns in the codebase?
- Are shared examples/contexts used where appropriate?
- Is test data handled consistently (fixtures vs factories)?
6. Identify Missing Scenarios
Look for common gaps:
- Nil/Empty Handling: What happens with nil, empty strings, empty arrays?
- Error Cases: Network failures, database errors, validation failures
- Concurrency: Race conditions, parallel execution
- Edge Cases: First/last items, exactly at limits, off-by-one
- Security: Input sanitization, authorization bypasses
- Performance: Large data sets, timeout scenarios
7. Check for Test Anti-Patterns
- Skipped/pending tests without justification
- Tests with
sleep or hardcoded delays (flaky test smell)
- Tests with non-deterministic data (random values without seeds)
- Over-reliance on
allow_any_instance_of or similar broad mocks
Note: This skill performs static analysis only. Test execution is handled separately to avoid redundant test runs.
Red Flags to Watch For:
- Tests that always pass (no real assertions)
- Tests that test Rails/framework behavior, not application code
- Overly complex test setup indicating design issues
- Mocking too much (testing mocks, not real behavior)
- No error case coverage
- Tests tightly coupled to implementation details
- Missing database state verification
- Frozen fixture assertions: Exact collection comparisons (
assert_equal [a, b], scope or expect(scope).to eq([a, b])) that break when unrelated fixtures are added. Recommend assert_includes/expect(...).to include(...) instead.
Test Quality Review Report
Provide your findings in this structure:
Test Coverage Summary
- Implementation Files Reviewed: [count]
- Test Files Reviewed: [count]
- Coverage Gaps Identified: [count]
- Quality Issues Found: [count]
Coverage Matrix
| Feature/Method |
Happy Path |
Sad Path |
Edge Cases |
Status |
| [method_name] |
pass/fail |
pass/fail |
pass/fail |
[Complete/Gaps] |
Critical Coverage Gaps
[List features/methods with missing test coverage, prioritized by risk]
- [Feature/Method Name] - [file:line]
- Missing: [what scenarios are not tested]
- Risk: [why this gap matters]
- Recommended: [specific test to add]
Test Quality Issues
High Priority:
- [Issue description with file:line reference]
- Recommendation: [how to fix]
Medium Priority:
- [Issue description]
- Recommendation: [how to fix]
Low Priority:
- [Issue description]
- Recommendation: [how to fix]
Missing Edge Cases
[List specific edge case scenarios that should be tested]
- [Scenario]: [why it matters] → [file to add test]
Pattern Violations
[Tests that don't follow project conventions or best practices]
Recommendations
- [Prioritized actionable recommendations]
- [Include specific test examples where helpful]
- [Reference project patterns to follow]
Overall Assessment
- Test Suite Health: [Excellent/Good/Needs Work/Critical Gaps]
- Confidence Level: [High/Medium/Low] - Can we ship with current tests?
- Priority Actions: [Top 3 things to fix before merging]
Note: Use clear repository-relative file paths and line numbers. Focus on actionable feedback that improves test quality and coverage.
1---2name: test-reviewer3description: Review automated tests for behavioral coverage, assertion quality, isolation, and missing failure cases. Use when assessing whether a change is sufficiently tested or whether a test suite gives reliable shipping confidence.4---56# Test Reviewer78**Audience:** Developers reviewing test suites for quality and completeness.910**Goal:** Analyze automated tests for coverage completeness, assertion quality, and adherence to testing best practices.1112## Review Steps1314### 1. Identify Test Context1516- Establish the review scope from the request, changed files, or provided diff17- Locate test files related to the changed behavior18- Identify the testing framework and repository conventions1920### 2. Map Implementation to Tests2122- Read the implementation files being tested23- Identify all public methods, endpoints, and behaviors that should have test coverage24- Create a coverage matrix mapping implementation features to test cases2526### 3. Analyze Test Coverage2728For each implementation feature, check if tests exist for:29- **Happy Path**: Normal successful execution flows30- **Sad Path**: Error conditions, validation failures, edge cases31- **Boundary Conditions**: Empty values, nil/null, maximum limits32- **State Transitions**: Before/after states, side effects33- **Authorization**: Permission checks (if applicable)34- **Integration Points**: External service calls, database operations3536### 4. Evaluate Test Quality3738- **Assertion Quality**:39 - Are assertions specific and meaningful?40 - Do tests verify behavior, not implementation?41 - Are error messages helpful for debugging?42- **Test Isolation**:43 - Do tests depend on execution order?44 - Are external services properly mocked?45 - Is test data properly set up and torn down?46- **AAA Pattern**:47 - Clear Arrange (setup) section48 - Single Act (execution)49 - Focused Assert (verification)50- **Test Names**:51 - Do names describe expected behavior?52 - Would someone understand the test without reading code?5354### 5. Check Test Patterns5556- **Framework Compliance**:57 - RSpec: Proper use of `describe`, `context`, `it`, `let`, `before`58 - Minitest: Proper use of `setup`, `test`, fixtures59 - Jest: Proper use of `describe`, `it`, `beforeEach`, mocks60- **Project Conventions**:61 - Do tests follow existing patterns in the codebase?62 - Are shared examples/contexts used where appropriate?63 - Is test data handled consistently (fixtures vs factories)?6465### 6. Identify Missing Scenarios6667Look for common gaps:68- **Nil/Empty Handling**: What happens with nil, empty strings, empty arrays?69- **Error Cases**: Network failures, database errors, validation failures70- **Concurrency**: Race conditions, parallel execution71- **Edge Cases**: First/last items, exactly at limits, off-by-one72- **Security**: Input sanitization, authorization bypasses73- **Performance**: Large data sets, timeout scenarios7475### 7. Check for Test Anti-Patterns7677- Skipped/pending tests without justification78- Tests with `sleep` or hardcoded delays (flaky test smell)79- Tests with non-deterministic data (random values without seeds)80- Over-reliance on `allow_any_instance_of` or similar broad mocks8182**Note:** This skill performs static analysis only. Test execution is handled separately to avoid redundant test runs.8384**Red Flags to Watch For:**85- Tests that always pass (no real assertions)86- Tests that test Rails/framework behavior, not application code87- Overly complex test setup indicating design issues88- Mocking too much (testing mocks, not real behavior)89- No error case coverage90- Tests tightly coupled to implementation details91- Missing database state verification92- **Frozen fixture assertions**: Exact collection comparisons (`assert_equal [a, b], scope` or `expect(scope).to eq([a, b])`) that break when unrelated fixtures are added. Recommend `assert_includes`/`expect(...).to include(...)` instead.9394## Test Quality Review Report9596Provide your findings in this structure:9798### Test Coverage Summary99- **Implementation Files Reviewed**: [count]100- **Test Files Reviewed**: [count]101- **Coverage Gaps Identified**: [count]102- **Quality Issues Found**: [count]103104### Coverage Matrix105| Feature/Method | Happy Path | Sad Path | Edge Cases | Status |106|----------------|------------|----------|------------|--------|107| [method_name] | pass/fail | pass/fail| pass/fail | [Complete/Gaps] |108109### Critical Coverage Gaps110[List features/methods with missing test coverage, prioritized by risk]1111121. **[Feature/Method Name]** - [file:line]113 - Missing: [what scenarios are not tested]114 - Risk: [why this gap matters]115 - Recommended: [specific test to add]116117### Test Quality Issues118119**High Priority**:120- [Issue description with file:line reference]121- Recommendation: [how to fix]122123**Medium Priority**:124- [Issue description]125- Recommendation: [how to fix]126127**Low Priority**:128- [Issue description]129- Recommendation: [how to fix]130131### Missing Edge Cases132[List specific edge case scenarios that should be tested]1331341. [Scenario]: [why it matters] → [file to add test]135136### Pattern Violations137[Tests that don't follow project conventions or best practices]138139### Recommendations1401. [Prioritized actionable recommendations]1412. [Include specific test examples where helpful]1423. [Reference project patterns to follow]143144### Overall Assessment145- **Test Suite Health**: [Excellent/Good/Needs Work/Critical Gaps]146- **Confidence Level**: [High/Medium/Low] - Can we ship with current tests?147- **Priority Actions**: [Top 3 things to fix before merging]148149**Note**: Use clear repository-relative file paths and line numbers. Focus on actionable feedback that improves test quality and coverage.