ISTQB Certified Tester Foundation Level
2-value vs 3-value boundary value analysis (ISTQB CTFL)
Boundary value analysis exercises the minimum and maximum values of ordered equivalence partitions. In 2-value BVA each boundary value gives two coverage items: the boundary value and its closest neighbour in the adjacent partition. In 3-value BVA it gives three: the boundary value and both its neighbours. ISTQB's CTFL v4.0 syllabus describes 3-value BVA as the more rigorous.
What is a boundary value?
The boundary values of a partition are its minimum and its maximum. BVA works only for ordered partitions: if two elements belong to a partition, every element between them must belong to it too. A list of unordered choices, such as payment methods, has no boundaries to analyse.
The technique targets boundaries because coding mistakes are most common there. The typical defects are a boundary implemented above or below its intended position, or a boundary left out altogether.
Worked example: 2-value and 3-value BVA
A field accepts whole numbers from 5 to 20. The valid partition has the boundary values 5 and 20. The invalid partitions next to it end at 4 and start at 21.
2-value BVA on the boundary value 5 gives 5 and 4, its closest neighbour in the adjacent partition. On 20 it gives 20 and 21. The coverage items for the valid partition's boundaries are 4, 5, 20 and 21. Coverage is the boundary values exercised divided by all identified boundary values.
3-value BVA on 5 gives 4, 5 and 6. On 20 it gives 19, 20 and 21. The coverage items are 4, 5, 6, 19, 20 and 21. The values 6 and 19 are coverage items but are not boundary values of any partition. Coverage is the boundary values and neighbours exercised divided by all identified boundary values and neighbours.
What does 3-value BVA catch that 2-value BVA misses?
Suppose the lower check should be n >= 5 but is coded as n == 5. The 2-value tests at 4 and 5 both pass: 4 is rejected and 5 is accepted. The 3-value test at 6 is likely to expose the defect, because 6 is wrongly rejected.
That is why the syllabus calls 3-value BVA more rigorous: it may detect defects that 2-value BVA overlooks. The price is more coverage items per boundary.
Where the exam catches people
- Applying BVA to an unordered set of values: BVA needs ordered partitions.
- Taking the second 2-value coverage item from inside the same partition: it is the closest neighbour in the adjacent partition. For a valid range of 5 to 20, the lower pair is 4 and 5, not 5 and 6.
- Believing every 3-value coverage item is a boundary value: the inner neighbours, such as 6 and 19 above, are coverage items but not boundary values.
- Getting the edge of a range wrong from its wording: 'at least 2 and fewer than 15' means the partition is 2 to 14, so its boundary values are 2 and 14.
- Believing 2-value and 3-value BVA find the same defects: a comparison coded as equality can pass every 2-value test and fail a 3-value test.