Skip to content

feat: Test quality checklist in /qa #91

Closed

Description

@admarble

Summary

Enhance /qa to evaluate test meaningfulness, not just existence or coverage. Catch tests that pass but don't actually validate behavior.

Problem

Common test quality issues that slip through:

  1. Testing implementation, not behavior

    // Bad: breaks if refactored, even if behavior unchanged
    expect(component.state.isLoading).toBe(true)
    
    // Good: tests observable behavior
    expect(screen.getByRole('progressbar')).toBeInTheDocument()
  2. Happy path only

    • No null/undefined handling
    • No error path testing
    • No boundary conditions
  3. Over-mocking

    // Mocking so much that you're testing mocks, not code
    jest.mock('./database')
    jest.mock('./auth')
    jest.mock('./api')
    jest.mock('./utils')
    // What's left to test?
  4. Snapshot abuse

    • Giant snapshots that nobody reviews
    • Snapshots of implementation details
  5. Flaky tests

    • Timing-dependent assertions
    • Order-dependent tests
    • Tests that pass in isolation but fail in suite

Proposed Solution

Add test quality evaluation to /qa checklist:

## Test Quality Review

### Behavior vs Implementation
- [ ] Tests assert on observable outputs, not internal state
- [ ] Tests would break if behavior breaks (not just if code changes)
- [ ] Refactoring internals shouldn't require test changes

### Coverage Depth
- [ ] Error paths tested (what happens when things fail?)
- [ ] Boundary conditions tested (empty, null, max values)
- [ ] Edge cases for the specific domain

### Mock Hygiene
- [ ] Mocks are minimal (only external dependencies)
- [ ] Integration points have at least one integration test
- [ ] Not mocking the thing being tested

### Test Reliability
- [ ] No timing-dependent assertions (use waitFor, not setTimeout)
- [ ] Tests are deterministic (same result every run)
- [ ] Tests are independent (no shared mutable state)

Acceptance Criteria

  • /qa skill includes test quality checklist
  • Checklist adapted per test type (unit, integration, e2e)
  • Common anti-patterns flagged with suggested fixes
  • Test quality section in QA output

Examples

Good QA Feedback

### Test Quality: ⚠️ Needs Attention

**Over-mocking detected in `auth.test.ts`:**
- 4 of 5 modules mocked, leaving little to actually test
- Consider: Test with real implementations, mock only external APIs

**Missing error paths in `checkout.test.ts`:**
- No tests for payment failure scenario
- No tests for network timeout
- Add: `it('handles payment decline gracefully')`

**Implementation testing in `UserCard.test.tsx`:**
- Line 45: Testing internal state `isExpanded`
- Refactor: Test the rendered output instead

Activity

  1. added
    enhancement
    on Jan 14, 2026
  2. admarble commented on Jan 21, 2026

    @admarble
    ContributorAuthor

    Consolidated into #147 (Comprehensive QA improvements)

  3. added 2 commits that reference this issue on Jan 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions