Testing · lesson 1 of 10
Ideas in this lesson
AError → defect → failurea person’s mistake, the flaw it leaves, what someone sees
BTestrunning the software to check it does what it should

Why test, and what testing can’t do

Last updated

Pila gives out the numbers that decide when a patient sees the doctor. If it gives two people the same number, or a 61st number nobody can serve, a real person waits all morning for nothing. Testing is how the team finds those mistakes before patients do. In this lesson you'll see what testing is for, name the chain from a person's mistake to a failure someone sees, and learn the limit every tester has to live with.

By the end of this lesson you can

  • Explain what testing is for: finding problems, and giving the team confidence to change the code
  • Tell an error, a defect and a failure apart
  • Explain why passing tests can't prove there are no bugs

What testing is for

A test runs the software, or part of it, to check it does what it should. Testing does two jobs for a team:

  • Find problems while they are cheap to fix: before release, before more code is built on top, before a patient is affected.
  • Give confidence to change the code. Pila will change every month. Automated tests that run in seconds tell Marco that his change to the priority lane didn't break the daily limit. Without them, every change is a gamble or a long morning of checking by hand.

Testing isn't only Rina's job. Everyone on the team tests: Marco writes unit tests for his own code, Rina explores the whole app, and Ate Cora tries it at the counter. Rina's job is to make sure the testing that matters gets done.

Error, defect, failure

Testers use three words for three different things, defined in the ISTQB glossary, the testing profession's shared vocabulary:

From a mistake to a failure
WordWhat it isIn Pila
Error (or mistake)A human action that produces a wrong resultMarco types > where he meant >=
Defect (also fault or bug)A flaw in the code or a document, left by an errorThe limit check now lets a 61st number through
FailureThe software doing something it shouldn’t, seen when it runsLola Remy gets number 61 and waits all morning to be told no

The chain matters because each link is a chance to stop it. Reviews (lesson 5.5) catch errors and defects before code runs. Tests make defects show themselves as failures, but on the team's computers, not at the health centre. A defect can also sit unnoticed for years if nothing ever runs it in the situation that triggers it.

Sort the chain

0 of 6 placed right

  1. Marco misreads the story and thinks the centre closes at 17:30

  2. CLOSES = time(17, 30) in queue_rules.py

  3. A patient texts at 17:10, gets number 41, and arrives to a locked door

  4. Jun copies the reply text from an old version of the design

  5. The README says python app.py, but the file is called web.py

  6. The waiting-room screen shows number 12 while the counter calls number 13

Ariane 5, flight 501

The most famous failure in testing's history shows the whole chain, and a test that was never run.

  1. 1980s Ariane 4’s software
1 of 6 1980s. The European Space Agency’s Ariane 4 rocket has an inertial reference system: a computer that works out where the rocket is and which way it points. Its software converts a 64-bit number to a 16-bit one. On Ariane 4’s path, the value always fits.

The software had no defect on Ariane 4. The same code became a defect when it was reused in a place it had never been checked. The board's lesson applies to Pila too: test with the situations the software will really meet, not only the ones it met before.

What testing can’t do

At a NATO conference in Rome in 1969, the computer scientist Edsger Dijkstra put the limit of testing in one sentence: “Testing shows the presence, not the absence of bugs.”

A passing test proves the code works for that one input. Pila's take_number takes any phone and any time of day: there are far too many combinations to try them all. So testers choose inputs carefully (lesson 6.3), and accept that a suite of passing tests means “no bugs found in what we checked”, not “no bugs”.

That's why teams combine ways of finding problems: reviews, automated tests at several levels (6.4), exploring by hand (6.7), and watching the running system (Stage 7). Each catches what the others miss.

Spot the trap: “it worked when I tried it”

Spot the trapJun

Jun has changed how Pila stores numbers. He texted Pila once from his own phone at 10 a.m., got number 1, and says: “It works. I tried it.”

What happens if…

Check what you learned

A wrong constant sits in queue_rules.py, but nobody has texted at the time it affects yet. What is it?
All 40 of Pila’s tests pass. What does that prove?
What did Ariane 5’s inquiry board find about testing?

Sources

Every claim on this page comes from these sources: the standard, the founding text of a method, a study, or the official record of a project, from the body that publishes it. Industry reports are labelled as such.

All sources for Simple Software Development