Skip to main content

Testing Protocol: Synthesizing 20+ Years of Testing Wisdom

· 2 min read
Max Kaido
Architect

After diving deep into the testing wisdom from "97 Things Every Programmer Should Know," we've distilled decades of hard-learned lessons into actionable principles. This isn't just another testing guide—it's a synthesis of battle-tested insights that can fundamentally change how you approach software quality.

Core Testing Philosophy

"Test Behavior Not Implementation"

The most common testing mistake is hardwiring tests to implementation details instead of focusing on behavioral contracts.

❌ BAD: Testing that your sorting function uses quicksort algorithm ✅ GOOD: Testing that sort([3,1,4]) returns [1,3,4]

Why: Implementation can change, behavior contract should remain stable. When you test implementation details, every refactor breaks your tests even when the behavior is correct.

"Concrete Not Vague"

Vague test assertions are bug magnets. Precision eliminates accidental complexity and catches edge cases.

❌ BAD: "Result should be sorted and same length" ✅ GOOD: Input [3,1,4,1,5,9] must produce exactly [1,1,3,4,5,9]

Why: The vague assertion would pass for [3,3,3,3,3,3] (sorted and same length, but completely wrong). Concrete examples eliminate ambiguity and make tests readable.

The Apollo 11 Bug Principle

Here's a mind-blowing real story: Apollo 11's lunar lander software contained TWO bugs that cancelled each other out. One bug made the lander unstable, another bug compensated for the first. Both bugs went undetected through two successful moon landings before either was discovered.

Application for Modern Development: When you fix one bug but the problem persists, look for compensating bugs. Multiple defects can appear as a single fault, leading developers down blind alleys where they dismiss correct fixes.

Defensive Strategy: Test for multiple failure modes and consider that "working" code might have hidden compensating defects.

Testing as Engineering Rigor

Unlike bridge builders who must build before they can test, software development has a massive advantage: building is ridiculously cheap. We can build, test, rebuild, and test again without physical constraints.

The Professional Argument: Testing is our equivalent of structural analysis in "hard" engineering. It's the professional engineering discipline that ensures quality.

Manager Response Template:

"We don't have time to test" = "Don't bother with structural analysis on that building—we have a deadline"

Testing isn't overhead—it's the core engineering practice that makes software development a legitimate engineering discipline.

Collaborative Prevention (ATDD)

Instead of the traditional cycle: code → test → find bugs → fix → repeat, flip it:

  1. Requirements → Write acceptance tests BEFORE coding
  2. Tests → Programmers implement to make tests pass
  3. Prevention → Defects are prevented, not caught

Benefits:

  • Clarifies requirements before coding starts
  • Prevents defects instead of catching them
  • Creates living documentation
  • Reduces back-and-forth between developers and testers

Precision vs Accuracy

Your tests must be both precise AND accurate:

  • Accurate: Tests the right thing (behavior, not implementation)
  • Precise: Tests with exact, concrete expectations
  • Both Required: Vague accurate tests miss bugs, precise inaccurate tests break on valid changes

The Synthesis

These principles aren't just academic—they're distilled from real production disasters, moon landing bugs, and decades of testing evolution. The synthesis creates a testing protocol that:

  1. Focuses on behavior contracts instead of implementation details
  2. Uses concrete examples to eliminate ambiguity
  3. Treats testing as engineering rigor not afterthought overhead
  4. Prevents defects through collaborative test-first approaches
  5. Considers compensating bugs and multiple failure modes

The Testing Mantra: "Test behavior not implementation, concrete not vague, prevent not react"

This isn't just about writing better tests—it's about fundamentally changing how we approach software quality from a reactive debugging mindset to a proactive engineering discipline.


This synthesis draws from insights by Kevlin Henney, Neal Ford, Janet Gregory, and Allan Kelly from "97 Things Every Programmer Should Know"—a treasure trove of hard-earned programming wisdom.