Skip to main content

Sign in to CleanKata

Track your progress, earn XP, and unlock every lesson.

By signing in you agree to our Terms of Use and Privacy Policy.

Clean Code60 XP6 min

Testing Heuristics

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

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.

🔧 Some exercises may still have errors. If something seems wrong, use the Feedback button (bottom-right of the page) to report it — it helps us fix it fast.

Hint: T1: Sufficient. T2: Use coverage. T3: Don't skip trivials. T5: Fix flaky tests. T8: Test boundaries. T9: Tests must be fast.

✗ Your version

Testing Heuristics — CleanKata — CleanKata