Course outline
Boundary value analysis tool
Give it a range, and it lists the values worth testing at each edge, the way the ISTQB syllabus describes them.
Many of the bugs that get through hide at the edges of what an input accepts: the last value that should work and the first that should not. A condition written as "less than 10" where the requirement says "10 or fewer" lives exactly there, and a test from the middle of the range never meets it.
Boundary value analysis picks the values on each edge and right next to it, so a handful of tests covers the whole range. Enter the range a requirement gives: the tool lists the values worth testing, and whether each one should be accepted or refused.
Use the tool
| Value | Expected | Where it sits |
|---|---|---|
| 0 | Invalid: refused | just below the minimum |
| 1 | Valid: accepted | the minimum |
| 10 | Valid: accepted | the maximum |
| 11 | Invalid: refused | just above the maximum |
How the method works
A range has two boundaries: its lowest valid value and its highest. Two-value analysis tests each boundary and its nearest neighbour outside the range: for 1 to 10, the values 0, 1, 10 and 11. Three-value analysis also tests the nearest neighbour inside, so 0, 1, 2, 9, 10 and 11. The ISTQB syllabus (version 4) teaches both; three-value analysis finds a few more mistakes for a few more tests.
The neighbour depends on the smallest step the input takes: 1 for whole numbers, 0.01 for money, one character for the length of a text. A text cannot be shorter than 0 characters, so for a length the tool never lists a value below 0.
- Read the requirement and write down the range: the lowest and the highest value it allows.
- Choose the step: the smallest difference between two values the input accepts.
- Test each value the tool lists: the valid ones must be accepted, the others refused with a clear message.
A worked example on Cedar Books
Cedar Books lets a shopper buy 1 to 10 copies of one book (requirement REQ-05). Two-value analysis gives these four tests:
| Value | Expected | Where it sits |
|---|---|---|
| 0 | Invalid: refused | just below the minimum |
| 1 | Valid: accepted | the minimum |
| 10 | Valid: accepted | the maximum |
| 11 | Invalid: refused | just above the maximum |
Three-value analysis adds 2 and 9. If a shop accepts 11 copies, or refuses 10, its boundary sits in the wrong place: the classic off-by-one mistake. Test the real limits of Cedar Books in the boundary values lab.