How to Use This Site

No fluff. Just a practical guide to diagnosing bad tests and fixing them fast.

The Problem This Site Solves

You know tests are important. But not all tests are good.

Many tests slow you down:

  • Flaky tests train you to ignore failures
  • Cryptic tests waste hours debugging
  • Brittle tests make you fear refactoring
  • Useless tests are just maintenance burden

The 9 Laws (Organized by Priority)

Tier 1: Can You Trust It? (Fix First)
  1. 1. Isolation - Tests are hermits
  2. 2. Speed - A slow test is already dead
  3. 3. Determinism - Flaky tests are worse than no tests

If Tier 1 fails, the test is worthless. Fix or delete immediately.

Tier 2: Can You Understand It? (Fix Second)
  1. 4. Signal Clarity - Fail loudly, fail obviously
  2. 5. Focus - One failure reason per test

If Tier 2 fails, debugging takes 10x longer.

Tier 3: Will It Age Well? (Fix Third)
  1. 6. Stability - Tests should survive refactoring
  2. 7. Setup Honesty - Every line of setup is a smell
  3. 8. Boundaries - Test your code, fake the world
  4. 9. Maintenance - Delete tests that don't pull their weight

If Tier 3 fails, tests rot over time. Only matters if test is worth keeping.

Using the Examples

1. Find Your Problem

Have a symptom? Quick lookup:

  • "Test fails randomly" → Law #3 (Determinism)
  • "Can't understand failure" → Law #4 (Signal Clarity)
  • "Refactor broke 40 tests" → Law #6 (Stability)
  • "Test has 50 lines of setup" → Law #7 (Setup Honesty)

2. Filter Examples by Law

Visit Examples and click the law filter. Each example is tagged with violated laws.

3. See Concrete Fixes

Each example shows bad code, good code, and why the fix works.

During Code Review

Pro tip: Link to specific law pages in your review comments. "This violates Law #3: Determinism" is more helpful than "this is flaky."

When Fixing Tests

Don't over-invest. Bad tests are worse than no tests.

If a test never fails, tests trivial logic, or is too expensive to fix: delete it (Law #9: Maintenance).

What This Site Is NOT

  • Not a testing 101: Assumes you know how to write tests
  • Not comprehensive: Focused on high-value vs low-value tests
  • Not dogmatic: Sometimes you need to break the laws (but know why)

Quick Start

1. Diagnose your test problem (flaky? cryptic? brittle?)

2. Identify which law it violates (use the symptom table)

3. Filter examples by that law

4. See concrete bad/good code

5. Apply the pattern to your codebase

Goal: Identify and fix (or delete) low-value tests in <60 seconds.