Skip to main content
Clean Code 60 XP · 6 min

Testing Heuristics

Apply the T1–T9 heuristics to write complete, meaningful, and maintainable test suites.

Showing
Ad (728×90)

T1–T4: Coverage and Completeness

T1: Insufficient tests — write enough to cover all conditions that could fail. T2: Use a coverage tool — it shows what you haven't tested, not that you've tested everything. T3: Don't skip trivial tests — they document expected behavior and cost almost nothing. T4: An ignored test raises a question — if you can't fix it now, document why.

T5–T9: Quality and Speed

T5: Don't skip failing tests — a skipped test is a known bug you've accepted. T6: Test near bugs — if you find a bug, add tests around it. T7: Patterns of failure are revealing — several tests failing together point to a single root cause. T8: Test boundary conditions — edges are where most bugs hide. T9: Tests must be fast — slow tests get disabled.

Code Challenge

Identify the T-heuristic violated in each test, then fix it.

Key takeaway

A test suite is only as good as its ability to catch real bugs quickly. Invest in coverage, speed, and completeness equally.

Done with this lesson?

Mark it complete to earn XP and track your progress.