QA Interview Hub · Knowledge base · Quizzes · Українська

QA Fundamentals › Test design techniques

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

invalidvalidinvalid < 18 18 … 65 > 65 103080 Unusual: empty, 18.5, abc, -1
Figure 1. Three numeric classes and unusual inputs, which also have behaviour of their own.

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

lower boundaryupper boundary 17No 18Yes 19Yes 64Yes 65Yes 66No
Figure 2. This is 3-value BVA for age 18–65. 17 and 66 must be rejected, the rest accepted.

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:

AgeRoleExpected
17below the lower boundaryrejected
18lower boundaryaccepted
19above the lower boundaryaccepted
30middle of the rangeaccepted
64below the upper boundaryaccepted
65upper boundaryaccepted
66above the upper boundaryrejected

In addition I check inputs that the system may handle differently, each with its own test:

InputWhat it checks
(empty)The field is required
0 and -5Zero and a negative: the same error as for 17, or a separate check
18.5A fraction: reject or round
abcNon-numeric input
" 30 "Spaces around the value
99999999999A very long number, overflow

A weak set and a strong one

Typical

30, 40, 50, 60

All values from the middle of the range. The error age > 18 stays unnoticed.

Better

17, 18, 19, 30, 64, 65, 66

The middle plus three values at each boundary. Six tests check the boundaries, one the class.

Figure 3. Only three values more than in the typical set, but it catches far more.

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.

In an interview. Junior: The classes for age 18–65 are the valid range and two invalid ones, below 18 and above 65. Boundaries: in 3-value that is 17, 18, 19, 64, 65, 66. Plus unusual inputs: empty, zero, negative, a fraction, letters. Middle/Senior: I combine classes with boundaries, because boundary values already cover the invalid classes, so only the middle of the range remains. I clarify the inclusiveness of the boundaries with the analyst. If age is computed from a date of birth, I check the boundaries in dates and with a time zone, not in years.

More articles in this chapter