← Workflows

阅读中文版本

Test Quality Review Workflow

Evaluate the tests in a change for meaningful assertions, edge cases, and isolation rather than mere presence.

intermediate~50 minreviewtestingquality

Objective

Ensure a change ships with tests that actually verify its behaviour.

Environment

  • A review checklist for tests
  • Coverage tools
  • The change under review

Steps

1. Check assertions are meaningful

Verify tests assert observable behaviour, not just that code runs.

Expected state: Tests would fail if the behaviour regressed.

2. Check edge and error cases

Look for boundary, empty, and error-path coverage.

Expected state: Important edge cases are tested.

3. Check isolation

Confirm tests do not depend on order, shared state, or real external services.

Expected state: Tests are independent and deterministic.

4. Check the change is actually exercised

Confirm the new behaviour has a test that fails without the change.

Expected state: Every new behaviour is covered.

Decision points

Require tests for every change?

  • For behaviour changes
  • For every line

Require tests for behaviour changes; demand value, not line coverage.

Accept snapshot-only tests?

  • Only with meaningful assertions too
  • Snapshots suffice

Snapshots alone rarely catch intent regressions; pair with assertions.

Expected outcome

Changes ship with tests that genuinely verify behaviour, catch regressions, and run reliably.

Verification

Confirm the tests fail without the change and cover edge cases and error paths.

Cleanup

Share recurring test anti-patterns with the team.

Overview

Ensure a change ships with tests that actually verify its behaviour.

This workflow is reusable across teams and environments; adapt the commands to your tooling while keeping the sequence and checkpoints intact.

Environment and prerequisites

  • A review checklist for tests
  • Coverage tools
  • The change under review

Procedure

1. Check assertions are meaningful

Verify tests assert observable behaviour, not just that code runs.

Expected state: Tests would fail if the behaviour regressed.

2. Check edge and error cases

Look for boundary, empty, and error-path coverage.

Expected state: Important edge cases are tested.

3. Check isolation

Confirm tests do not depend on order, shared state, or real external services.

Expected state: Tests are independent and deterministic.

4. Check the change is actually exercised

Confirm the new behaviour has a test that fails without the change.

Expected state: Every new behaviour is covered.

# confirm tests fail without the change
git stash -- src/ && npm test; git stash pop

Verification

Confirm the tests fail without the change and cover edge cases and error paths.

Decision points

Require tests for every change?

  • For behaviour changes
  • For every line

Recommendation: Require tests for behaviour changes; demand value, not line coverage.

Accept snapshot-only tests?

  • Only with meaningful assertions too
  • Snapshots suffice

Recommendation: Snapshots alone rarely catch intent regressions; pair with assertions.

Common failures

  • Tests that only run code catch nothing.
  • Order-dependent tests cause flakiness.
  • Snapshot-only tests miss intent regressions.