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:
| Word | What it is | In Pila |
|---|---|---|
| Error (or mistake) | A human action that produces a wrong result | Marco types > where he meant >= |
| Defect (also fault or bug) | A flaw in the code or a document, left by an error | The limit check now lets a 61st number through |
| Failure | The software doing something it shouldn’t, seen when it runs | Lola 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
Marco misreads the story and thinks the centre closes at 17:30
CLOSES = time(17, 30)in queue_rules.pyA patient texts at 17:10, gets number 41, and arrives to a locked door
Jun copies the reply text from an old version of the design
The README says
python app.py, but the file is called web.pyThe 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.
- 1980s Ariane 4’s software
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”
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
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.
- Software Engineering Techniques: Report on a conference sponsored by the NATO Science Committee, Rome, 1969: Dijkstra’s remark on what testing shows
- ISTQB Glossary: failure: with the linked entries for error and defect
- ARIANE 5 Flight 501 Failure: Report by the Inquiry Board (ESA, 1996): the reused code, the overflow, and the tests that weren’t run
- Martin Fowler: Test Pyramid: why automated tests matter to a team that changes code often