PRINCIPALCHAPTER 32

A history: from debugging to test-driven development to chaos

Every testing technique was invented to fix the blind spot of the one before it, and you choose better when you know which blind spot you are paying to fix

45 MINSOFTWARE TESTING AND QUALITYUPDATED 2026-11-24
PREDICT

You run 20,000 random inputs through the legacy instalment function from the project in module 1, which has a silent date bug when a plan runs past December. The only thing you check is whether the function crashes. How many of the 20,000 runs crash?

You will meet each of these techniques again, with a lab, in other chapters. This chapter is the thread through them. It is not a list of dates to memorise. For each idea you want four things: when it appeared, who wrote it down, the problem that made it worth writing down, and the price. The price matters most. A technique with a price you cannot name is one you do not yet understand.

Dates and quotations below come from the sources in the reading list and the links in the text. Where a source is secondary, the text says so.

Before testing: finding your own mistakes

The first stored-program computers were used before anyone had a word for testing. By June 1949, at Cambridge, Maurice Wilkes was walking between the room that held EDSAC and the equipment that punched its programs. He recalled in his memoir that he realised “a good part of the remainder of my life was going to be spent in finding errors in my own programs.” Russ Cox’s account of the moment also records EDSAC’s log for 7 May 1949: “Table of primes attempted — programme incorrect.” The famous first programs did not all run first time.

The activity of those years was debugging: run it, look at what came out, work out what went wrong, change it. It is the technique you use in step 1 of the lab when you print a schedule and read it. It works, it needs no tools, and it has two limits that every later idea attacks. It depends on you noticing that the output is wrong, and it leaves nothing behind. When you fix the bug, the evidence that it was ever there goes with your print statements.

1949: checking a routine on paper

In the same month, Alan Turing presented a three-page paper to the Cambridge conference on high-speed automatic calculating machines. It was called Checking a Large Routine. Freek Wiedijk’s summary of it says that it shows how to verify a program that computes the factorial by repeated addition, and that it uses invariants to show the result is right and a variant to show the program terminates. The program is given as a flow chart, and the checker writes down what must be true at each marked point.

Look at what that is. An invariant is a statement that holds every time control passes a point. An assertion in code is the same statement in a form the machine can check. Turing did not have a machine that could check it; a person did. So the idea sat for a long time as a proof technique, and the same idea came back, in a form a machine can run, as the assert statements you will write in step 2 of the lab.

What it solved: it replaced “I looked and it seemed right” with a statement someone else can check. What it cost: someone has to know what must be true. For a factorial that is easy. For a 24-line instalment function nobody owns, it is the hard part, and it is still the hard part of every test you write.

1950s to 1970s: demonstration, and the doubt about it

Gelperin and Hetzel, in a 1988 article in Communications of the ACM, divided the history of testing into periods, each with its own goal for the activity. The summary table below follows the article’s divisions as secondary sources report them (the article itself is behind a publisher’s wall, so the period boundaries are unconfirmed: check them against the ACM PDF if you cite them).

Period Dates What testing was for
Debugging-oriented to 1956 Finding and fixing faults; not separated from debugging
Demonstration-oriented 1957 to 1978 Showing that the program satisfies its requirements
Destruction-oriented 1979 to 1982 Finding faults by trying to break the program
Evaluation-oriented 1983 to 1987 Judging quality across the life cycle
Prevention-oriented 1988 on Finding faults early and preventing them

Treat the dates as a teaching device. Practices overlap and nobody woke up in 1979 and changed their mind.

The turn from the second row to the third has two documents behind it. In 1969 (EWD249 is dated August 1969, with a second edition in 1970), Dijkstra’s Notes on Structured Programming put it in one sentence, the corollary to the first part of its section on the reliability of mechanisms: “Program testing can be used to show the presence of bugs, but never to show their absence!” If that is true, a test run that shows no failures shows that you did not find one. Demonstration cannot be the goal.

Glenford Myers drew the working conclusion in The Art of Software Testing, first published in 1979. In the chapter on the psychology of testing, Myers’ third edition (2012) says that a successful test case is “one that furthers progress in this direction by causing the program to fail”, where the direction is finding the errors in a program whose presence you assume. The point is about people. If you are rewarded for tests that pass, you write tests that pass. If you are rewarded for failures, you hunt.

That is the idea behind the choosing test cases chapter: boundary values and equivalence classes are tools for hunting, not for demonstrating.

There was a second line of thought in the same decade, and it matters because the manager in the Why box is sitting on it. Michael Fagan’s paper in the IBM Systems Journal in 1976, “Design and code inspections to reduce errors in program development”, argued that formal inspections of design and code could improve quality and productivity. It is an ancestor of the code review you do today, and of the prevention period in the table. Takumi’s binder and a code review are the same bet: that people reading carefully catch what a run does not.

What demonstration solved: it gave a team a reason to run anything at all. What it cost: a passing run was read as evidence of absence, which it never was.

1978: testing the tests

If tests find bugs, how do you know your tests are any good? DeMillo, Lipton and Sayward’s paper in IEEE Computer in 1978, “Hints on Test Data Selection: Help for the Practicing Programmer”, proposed an answer that became mutation testing. Change the program in a small way, run the tests, and if they still pass, the tests did not notice. Course notes that summarise the paper describe two ideas under it: that programmers write code close to correct, and a coupling effect, the conjecture that tests which catch simple faults also tend to catch complex ones. The paper’s PDF could not be fetched when this chapter was written, so those two ideas are as the notes report them. Both are conjectures, and later work tested them.

You ran this idea in coverage and mutation testing: scripts/mutate.py on checkout/pricing.py gave a mutation score of 41% on a file with 92% branch coverage. That gap is the 1978 argument in numbers.

What it solved: it measured a test suite by whether it detects faults, not by whether it runs lines. What it cost: machine time. Every mutant is a full test run, which is why the idea waited decades for cheap compute.

1990s: the machine runs the tests, and the tests come first

Two changes came together. A test is a program, so any program that runs tests automatically, and reports one line per failure, makes tests cheap to repeat. Martin Fowler’s note on the xUnit family says that Kent Beck’s framework for running automated tests in Smalltalk was ported to Java as JUnit, and that JUnit “was born on a flight from Zurich to the 1997 OOPSLA in Atlanta”, when Beck and Erich Gamma built the first version, pair programming and test first. The family of tools that followed, for most languages, is why pytest looks the way it does.

Once repeating a test costs nothing, the order of work can change. Beck made the practice of writing the test before the code a central part of Extreme Programming, and described it in Test-Driven Development: By Example (Addison-Wesley, 2002). The TDD chapter covered the loop and its limits. What matters for the history is the problem it targeted: a test written after the code often passes on its first run, which gives you no evidence it can fail.

The third piece completes the loop. Fowler’s article on continuous integration says the practice was developed by Kent Beck as part of Extreme Programming in the 1990s, and its rule of thumb is that every developer commits to the mainline every day, which makes self-testing code a prerequisite. Tests that run on every change only work if they are fast, and tests on every change is the engineering chapter on that. At scale the same idea has a different shape, which CI at scale covers.

What it solved: cheap repetition, and a habit that makes the test fail first. What it cost: a suite of hand-written examples grows with the code, and it only checks what someone thought to write.

1990 and 2000: random input, then a law to check it against

The next idea comes from an accident. Miller, Fredriksen and So describe it in their CACM paper of December 1990: one of the authors was working on a dial-up line from home on a stormy night, the rain had affected the phone line, and spurious characters were making basic utilities crash. They built a program to generate random characters and fed it to nearly 90 utilities on seven versions of UNIX. They crashed more than 24% of them. The Wisconsin fuzz page says the project began as an assignment in a graduate operating-systems course in autumn 1988. The causes they found include pointer and array errors, and the “gets finger” bug, a call to gets() that had been one of the security holes the Internet worm used.

What random testing found was inputs no person would write. What it needed was nothing: no spec, no examples. What it could see was only a crash or a hang. A program that returns the wrong answer politely passes. That is the blind spot you test in the lab with the Predict question.

In 2000, Koen Claessen and John Hughes, at Chalmers, presented QuickCheck at ICFP in Montreal. The paper describes a tool in which properties are written as functions and tested on random input. Its first example is prop_RevRev xs = reverse (reverse xs) == xs; it reports OK: passed 100 tests, and for a wrong law such as reverse (xs++ys) == reverse xs++reverse ys it reports a counterexample (“Falsifiable, after 1 tests” and the two lists it found). The implementation, the authors say, was a single Haskell module of about 300 lines. They also say something that is easy to skip: random testing is meaningless without a discussion of the distribution of test data, so QuickCheck lets the tester control it with generators.

That is Miller’s randomness joined to Turing’s idea of a statement that must hold. Hypothesis, which you used in property-based testing, is the same idea for Python.

What it solved: inputs you did not think of, and, with a property, wrong answers as well as crashes. What it cost: you have to state a law, and you have to shape the generator. A property is as wide as its generator, and a generator that never reaches the bug cannot find it.

2011 and 2016: the test moves into production

Everything above runs before release, in an environment you built. A distributed service fails in ways that environment does not reproduce: a machine disappears, a dependency slows down, a retry storm starts. Netflix’s July 2011 tech-blog post, “The Netflix Simian Army” by Yury Izrailevsky and Ariel Tseitlin, announced a family of tools whose first member, Chaos Monkey, picks an instance at random in each cluster and turns it off without warning during business hours, as later described by InfoWorld, which attributes the description to Jones and Rosenthal’s book and not to the 2011 post; the post itself now redirects to Medium, which refused automated fetches when this chapter was written). The reason, in the SEI’s case study, is a line from the engineers: the only way to be comfortable handling failure is to constantly practice failing.

In 2016 Basiri and six colleagues at Netflix wrote the idea up as Chaos Engineering in IEEE Software. The Principles of Chaos Engineering site gives the shape of an experiment in four steps: define a steady state as a measurable output that indicates normal behaviour; hypothesise that it will continue in the control group and the experimental group; introduce variables that reflect real events such as servers crashing; and try to disprove the hypothesis by looking for a difference between the groups.

Read that as a test. It has a steady-state assertion, an input you control, and a verdict. It differs from the others in where it runs and in what it protects against. Testing in production covers canaries, flags and synthetic checks, the neighbours of the experiment.

What it solved: failure modes that exist only in the real system. What it cost: a real blast radius. You need a steady-state signal you trust, a way to stop in seconds, and a team that has agreed to the risk.

The pattern, and the trade

Put the whole thread in one table, with the course chapter that teaches each.

Idea Year Source Problem it was built for Price Chapter
Debugging 1940s Wilkes, memoir, 1949 Programs have mistakes You must notice; leaves nothing behind A first unit test
Checking a routine 1949 Turing Looking is not evidence Someone must know what must be true What a good test looks like
Testing to fail 1969, 1979 Dijkstra; Myers Passing runs prove little Needs a different incentive Choosing test cases
Inspection 1976 Fagan Faults are cheapest to find early Reading time Code review
Mutation 1978 DeMillo, Lipton, Sayward Are the tests any good? A full run per mutant Coverage and mutation testing
Fuzzing 1990 Miller, Fredriksen, So Inputs nobody wrote Sees only crashes Security testing
Automated runners, test-first, CI 1997 to 2002 Beck and Gamma; Beck; Fowler Tests are too costly to repeat A suite grows and checks only what was written Test-driven development
Property-based testing 2000 Claessen, Hughes Fuzzing with a verdict A law and a generator to write Property-based testing
Chaos experiments 2011, 2016 Netflix; Basiri et al. Failures that exist only in production Blast radius Testing in production

Three things stand out.

Nothing was replaced. Takumi’s manual plans are the oldest row that is still in daily use, because a person walking a card screen finds what no assertion thought to check. The newest rows did not make the older ones obsolete. They moved the cost.

Each row has a blind spot, and the next row is the cure. Fuzzing sees only crashes, so QuickCheck added a law. Examples check only what you wrote, so properties generate them. A suite that runs everywhere before release says nothing about a region going dark, so you run the experiment in production.

Fashion looks like progress. A technique arrives with a conference talk and a tool, and a team adopts it for the tool’s sake. The question to ask is the one in the table’s fourth column: does this team have that problem, and can it pay the price in the fifth? A unit that ships a monthly release of one monolith has no use for chaos experiments. A unit with 150 services and a retry policy that nobody has ever exercised does.

If you want the evidence for which of these pay, rather than the history, the next chapter in this module, what the research says about tests, reviews and defects, is the chapter that weighs them.

LAB Find one bug five ways, and time each ~40 MIN
YOU NEEDPython 3.9 or laterlabs/testing set up as in its README (a .venv with the pinned requirements)the legacy function from the project in module 1, as it stands in the lab (do not fix it yet)no Docker, no servers

You take one bug and find it with a technique from each of the periods above. The bug is the one in checkout/legacy.py, the instalment scheduler from the legacy-function project. You have found it once already, so this lab is not about finding it. It is about what each technique needed from you and what it could see. Everything runs from labs/testing. Output is trimmed, and times will differ on your machine.

If you fixed legacy.py in the project, put the original back first with git checkout checkout/legacy.py.

1. Debugging: print it and read it. Create history/t1_prints.py.

cd labs/testing
mkdir -p history
cat > history/t1_prints.py <<'EOF'
"""1950s style: run it, print it, read it."""
from checkout.legacy import make_schedule

for total, n, y, m, d in [(3000, 3, 2026, 3, 15), (3000, 3, 2026, 11, 15), (1000, 4, 2026, 1, 31)]:
    print(total, n, (y, m, d))
    for row in make_schedule(total, n, y, m, d):
        print("   ", row)
EOF
time PYTHONPATH=. .venv/bin/python history/t1_prints.py

Three plans print. The second reads ('2026-11-15', 1000), ('2026-12-15', 1000), ('2026-01-15', 1000): the third row has gone back to January 2026 instead of January 2027. The third plan shows days capped at 28, which the function documents, so it is not a bug. The run takes well under a second. Note what the technique needed: you had to choose the November input, and you had to notice the year. Write down how many inputs you printed before you saw it.

2. Checking a routine: assertions that must hold. In Turing’s form, say what must be true at a point. Here the points are the end of the function.

cat > history/t2_asserts.py <<'EOF'
"""Turing 1949 shape: a checkpoint is a statement that must be true at one point."""
from checkout.legacy import make_schedule

def check(total, n, y, m, d):
    plan = make_schedule(total, n, y, m, d)
    assert sum(k for _, k in plan) == total, "amounts must sum to the total"
    assert len(plan) == n, "one row per instalment"
    months = [int(s[5:7]) for s, _ in plan]
    years = [int(s[:4]) for s, _ in plan]
    for i in range(1, n):
        wrapped = months[i] < months[i - 1]
        assert years[i] == years[i - 1] + (1 if wrapped else 0), (
            "the year must go up when the month wraps: %r" % (plan,)
        )

check(3000, 3, 2026, 3, 15)
print("March start: all assertions hold")
check(3000, 3, 2026, 11, 15)
print("November start: all assertions hold")
EOF
time PYTHONPATH=. .venv/bin/python history/t2_asserts.py

March start: all assertions hold, then a traceback ending in AssertionError: the year must go up when the month wraps: [('2026-11-15', 1000), ('2026-12-15', 1000), ('2026-01-15', 1000)]. The sum and length checks pass on both plans, as they should. The statement about the year is the one that fails, and it fails with a message that names the rule. Compare with step 1: the bug is now reported by the machine, but you still chose the November input.

3. A unit test: an example with an expected value. The 1990s form.

cat > history/test_t3_unit.py <<'EOF'
"""1990s style: an example, an expected value, an automatic runner."""
from checkout.legacy import make_schedule

def test_a_plan_that_runs_into_january_moves_to_the_next_year():
    plan = make_schedule(3000, 3, 2026, 11, 15)
    assert plan[-1] == ("2027-01-15", 1000)
EOF
.venv/bin/python -m pytest history/test_t3_unit.py -p no:randomly -q

assert ('2026-01-15', 1000) == ('2027-01-15', 1000) with a diff at index 0, and 1 failed, in about 0.2 s. The difference from step 2 is not the power of the check. It is that the test is named, repeatable, and stays in the repository when you fix the bug.

4. A property: a law and a generator. The 2000 form. State what any schedule must satisfy and let Hypothesis choose the plans.

cat > history/test_t4_property.py <<'EOF'
"""2000 style: state the law, let the machine find the example."""
from hypothesis import given, strategies as st

from checkout.legacy import make_schedule

@given(
    total=st.integers(min_value=1, max_value=10_000_000),
    n=st.integers(min_value=1, max_value=12),
    y=st.integers(min_value=2024, max_value=2030),
    m=st.integers(min_value=1, max_value=12),
    d=st.integers(min_value=1, max_value=31),
)
def test_each_instalment_is_one_month_after_the_last(total, n, y, m, d):
    plan = make_schedule(total, n, y, m, d)
    months = [int(s[:4]) * 12 + int(s[5:7]) for s, _ in plan]
    assert months == list(range(months[0], months[0] + n))
EOF
.venv/bin/python -m pytest history/test_t4_property.py -p no:randomly -q

1 failed in about two seconds. The assertion line shows two month numbers that do not step by one, assert [24300, 24289] == [24300, 24301], and the Falsifying example: block names the shrunk input: total=1, n=2, y=2024, m=12, d=1, with comments marking total, y and d as free to vary (# or any other generated value). Hypothesis found a December start and shrank to two instalments. It also prints a patch command for .hypothesis/patches/, which you can ignore. You did not choose the input.

5. A fuzz run, in its 1990 and 2000 forms. First count crashes only, as Miller did. Then check the same law on the same random inputs.

cat > history/t5_fuzz.py <<'EOF'
"""1990 style: random input, and the only oracle is 'did it crash'.
Then the 2000 step: add a law to check, and the same random input finds the bug."""
import random

from checkout.legacy import make_schedule

random.seed(1990)
runs = 20_000
crashes = 0
broken_law = 0
smallest = None
for _ in range(runs):
    args = (random.randint(1, 10**7), random.randint(1, 12), random.randint(2024, 2030),
            random.randint(1, 12), random.randint(1, 31))
    try:
        plan = make_schedule(*args)
    except Exception:
        crashes += 1
        continue
    months = [int(s[:4]) * 12 + int(s[5:7]) for s, _ in plan]
    if months != list(range(months[0], months[0] + args[1])):
        broken_law += 1
        if smallest is None or args[1] < smallest[1]:
            smallest = args
print("runs:", runs)
print("crashes (the 1990 oracle):", crashes)
print("runs that break the month law (the 2000 oracle):", broken_law)
print("a failing input:", smallest)
EOF
time PYTHONPATH=. .venv/bin/python history/t5_fuzz.py
runs: 20000
crashes (the 1990 oracle): 0
runs that break the month law (the 2000 oracle): 9115
a failing input: (2444162, 2, 2024, 12, 9)

It takes about 0.2 s. The crash count is 0: this function never raises, so a crash-only oracle finds nothing in 20,000 runs. The same inputs with a law find the bug in 9,115 of them. With the seed above the count is the same on every run. The oracle, not the random input, made the difference.

6. Fill the timeline. Make a table in history/timeline.md with one row per step. Give each row: the technique, the period it comes from (use the dates in this chapter), what you had to know before you started, the seconds it took to run, and what it could not see. A start for the first two rows:

Step Needed from you Run time Could not see
1 Print and read the right input and the eyes to spot a wrong year under 1 s any input you did not print
2 Assertions the rule, in code, and the right input under 1 s any input you did not pass

Your table has five rows and the last three differ from the first two in one column: what you needed. Steps 3 and 4 needed the rule (step 3 also needed the input; step 4 only the range). Step 5 needed the rule and nothing else. Run times are all under three seconds, so on a function this small, speed is not what separates the techniques.

Narrow the property’s generator and watch the history repeat. Copy history/test_t4_property.py to history/test_t4_narrow.py, change n to max_value=6 and m to max_value=6 in the new file, and run it with .venv/bin/python -m pytest history/test_t4_narrow.py -p no:randomly -q. It reports 1 passed: with at most six instalments starting no later than June, no plan crosses December, so the law never fails and the bug is hidden. You have a green test over a broken function. Hypothesis was not wrong; you told it where to look. Then fix checkout/legacy.py: replace the if mm > 12: block with yy = y + (mm - 1) // 12 and mm = (mm - 1) % 12 + 1. Run .venv/bin/python -m pytest history -p no:randomly -q and PYTHONPATH=. .venv/bin/python history/t5_fuzz.py: the tests pass (step 3’s test, the full property and the narrow one) and the fuzz law counts 0 broken runs. When you have finished, restore the original with git checkout checkout/legacy.py and delete history/ and .hypothesis/.

DECIDE

Katya's bank unit has a 1990s binder of manual test plans for card-payments screens, a 2024 pipeline running 11,000 automated tests per commit, and a proposal to add fuzzing, mutation testing and a production chaos experiment. She has one quarter and two spare test engineers. She asks for a recommendation that names the problem each choice solves.

READING
  1. PAPER
    The Growth of Software Testing David Gelperin, Bill Hetzel, 1988

    The source of the debugging, demonstration, destruction, evaluation and prevention periods that most histories repeat. Read it before you cite the dates. The publisher's site refused automated fetches when this chapter was written, so the dates above come from secondary summaries. Read: The periods and the table that summarises them; skip the sections on methodology..

  2. PAPER
    A large routine Freek Wiedijk, 2016

    A short, readable description of what Turing's three pages say, with the program in C. It is the quickest way to see invariants and a variant in their first form. Read: The first page, which describes Turing's 1949 paper and the factorial program; skip the speculation about the machine..

  3. PAPER
    Notes on Structured Programming (EWD249) Edsger W. Dijkstra, 1969

    Written in August 1969, with a second edition in 1970. The primary source for the sentence everyone quotes about testing and the absence of bugs, with the argument about why exhaustive testing is out of the question. Read: The part headed &ldquo;On the reliability of mechanisms&rdquo;, for the corollary about testing; skim the rest..

  4. PAPER
    An Empirical Study of the Reliability of UNIX Utilities Barton P. Miller, Lars Fredriksen, Bryan So, 1990

    The original fuzz study. It is short, it names the causes it found, and it shows how little tooling the idea needed. Read: The introduction for the dial-up story and the classification of causes; skip the per-utility tables..

  5. PAPER
    QuickCheck: A Lightweight Tool for Random Testing of Haskell Programs Koen Claessen, John Hughes, 2000

    The paper that put a checkable law next to random input. Read the sections on the distribution of test data, which most summaries leave out and which explain why generators matter. Read: Sections 1 to 3, on properties and generators; skip the Haskell-specific case studies if you do not read Haskell..

  6. PAPER
    Chaos Engineering Ali Basiri and six co-authors at Netflix, 2016

    The authors' own definition of the practice and its principles. Pair it with principlesofchaos.org, which states the four steps of an experiment. Read: The principles and the experiment design; skip the survey of tooling..

  7. POST
    Continuous Integration Martin Fowler, 2006

    Explains the practice, its origin in Extreme Programming and why self-testing code is a prerequisite. Read the section on committing to the mainline daily; skip the product list.

  8. POST
    The Discovery of Debugging Russ Cox

    A short account of Wilkes in 1949 and of the EDSAC log, with the sources, and a correction to the story that the first programs ran correctly.

All companies and people in these examples are fictional. Any resemblance to a real business or person is unintended.

RECALL CARDS Tap to flip. They join your review deck when you mark the lesson complete.
NEXT: What the research says about tests, reviews and defects →