Equivalence classes and boundary values: age 18–65
For an age field of 18 to 65 a sufficient set combines classes and boundaries: 17, 18, 19, 64, 65, 66 and one value from the middle, such as 30. The boundary values 17 and 66 already lie in the invalid classes, so separate representatives 10 and 80 are redundant. Empty, zero, negative, fractional and non-numeric input are also checked, and boundary inclusion is clarified with the analyst.
QA Fundamentals · Test design techniques
The "age" field accepts 18–65. What is the smallest set of values that covers both classes and boundaries?
The age field in a questionnaire must accept from 18 to 65. It is the classic example that shows how two techniques work together: equivalence classes give the structure, and boundary values catch errors at the edges. Below we work out which values to take, why part of the "representatives" become redundant and what else to check besides numbers.
How it works and why
Classes first. For the field "age 18–65" there is a valid class 18–65 and two invalid ones: less than 18 and more than 65. Representatives: 30, 10 and 80. One test per class, because the system handles all values of a class by one rule.
Classes for age 18–65
Then boundaries. Errors in conditions like age > 18 instead of >= 18 live where the two variants diverge, that is, at the boundary itself. The site convention applies here: 2-value BVA gives four values (17, 18, 65, 66), 3-value BVA gives six, three at each boundary (17, 18, 19, 64, 65, 66).
Six values near the boundaries 18 and 65
Example: the final set of tests
Now we combine. Notice that 17 already lies in the class "less than 18" and 66 in the class "more than 65". So the separate representatives 10 and 80 become redundant: the boundary values already cover those classes. Of the classes only the middle of the range remains, and the set shrinks to seven values:
| Age | Role | Expected |
|---|---|---|
| 17 | below the lower boundary | rejected |
| 18 | lower boundary | accepted |
| 19 | above the lower boundary | accepted |
| 30 | middle of the range | accepted |
| 64 | below the upper boundary | accepted |
| 65 | upper boundary | accepted |
| 66 | above the upper boundary | rejected |
In addition I check inputs that the system may handle differently, each with its own test:
| Input | What it checks |
|---|---|
| (empty) | The field is required |
| 0 and -5 | Zero and a negative: the same error as for 17, or a separate check |
| 18.5 | A fraction: reject or round |
| abc | Non-numeric input |
| " 30 " | Spaces around the value |
| 99999999999 | A very long number, overflow |
A weak set and a strong one
30, 40, 50, 60
All values from the middle of the range. The error age > 18 stays unnoticed.
17, 18, 19, 30, 64, 65, 66
The middle plus three values at each boundary. Six tests check the boundaries, one the class.
Limits and alternatives
- Whether the boundaries are inclusive must be clarified with the analyst: "from 18 to 65" may mean 18 ≤ age ≤ 65 or 18 ≤ age < 65. This is the most common ambiguity in requirements, and it is better closed before the tests.
- In real forms age is almost never typed as a number. It is computed from a date of birth, and the boundary becomes a date: a person who "turns 18 tomorrow" is still 17. Then boundary values are taken in dates, not years, taking the time zone into account.
- For a field with several boundaries (for example, tariffs by age 0–17, 18–65, 66+), each boundary is taken separately, and adjacent ranges do not repeat shared values.
Typical mistakes
- Adding "middle" values instead of boundary ones. 30, 40, 50 and 60 add nothing new.
- Not checking values outside the range. It is 17 and 66 that show the rejection works.
- Duplicating representatives of classes already covered by boundaries. These are extra tests with no new information.
- Not trying unusual inputs. An empty field and a decimal number often fail first.
Check yourself
Why do the separate representatives 10 and 80 become redundant when 17 and 66 are already in the set?
Answer
Because 17 lies in the class "less than 18" and 66 in the class "more than 65", so the boundary values already cover those classes. An extra test with 10 or 80 checks the same handling branch and gives no new information.
How many values are there in 2-value and 3-value BVA for the range 18–65?
Answer
2-value has four values: 17, 18, 65, 66. 3-value has six values: 17, 18, 19, 64, 65, 66.
Which clarification of the requirements is almost always needed for the field "from 18 to 65"?
Answer
Whether the boundaries are inclusive, that is, whether exactly 18 and exactly 65 are accepted. The expected result for two of the six boundary values depends on it.