Testing note · Software quality
Four tests. One hidden mistake. Where would you look?
A form should accept an age only from 18 to 65. That rule is the spec. Someone wrote the code, and it has one small mistake. A test means: give it one age, then compare its answer with the spec. Testers rarely get to try everything, so the skill is choosing a few inputs that would catch the mistake.
Count the posts of a fence that has some number of sections. Slide it and watch: the posts are always one more than the sections. Code that counts sections when it should count posts is off by one. It is the most common bug at an edge.
The spec is below. The program has one secret off-by-one mistake, at either the lower or the upper edge.
1Type an age and press Add test. You may add up to four. 2Press Run. 3Read the table.
The program treats all ages below 18 the same way, so one example from that group says as much as a hundred. The same holds for the middle and for the top. The mistakes hide where the groups meet, so a good set of tests is one value from each group, plus the values on each side of every border.