Boundary Value Analysis
Boris Beizer an American software engineer and author says that "Bugs lurk in corners
and congregate at boundaries ...“
One thing we know about the kinds of mistakes that programmers make is that errors tend
to cluster around boundaries.
Some developers might get confused about our employee age and intentionally get confused
about the numbers 20 and 50 and put them out of range
a developer might use the wrong comparison sign and use less than instead of less than
or equal or vice versa.
There’re many ways developers can make such mistakes
Boundary value analysis works hand in hand with our equivalence partitioning from the
previous lecture because partitions have boundaries, but can only be used when the partition is
ordered, consisting of numeric or sequential data.
The minimum and maximum values (or first and last values) of a partition are its boundary
values.
In our employee age example, where we have the accepted employee age in the range from
20 to 50.
We had 3 partitions, so we need to identify the boundaries for each partition… the first
partition 20 to 50 has the boundaries of 20 and 50 which are valid boundaries.
Assuming we can limit the input so no -ve numbers are allowed…The second partition,
less the 20 has a boundary of 0 and 19.
The third partition, above 50 has a boundary of 51 and there’s no second boundary in
this partition because it extends to +ve infinity.
The technique used here is called two boundary values per boundary.
Meaning… if we look form the valid partition point of view, for the lower boundary, we
identify the value AT the boundary and the value just below the lower boundary and for
the higher boundary as test values, we identify the value AT the boundary and the value just
above the higher boundary as test values.
So The boundary between invalid (too low) and valid gives the test values 19 and 20.
The boundary between valid and invalid (too high) provides the test with values 50 and
51.
Some variations of this technique identify three boundary values per boundary: where
for each boundary we identify the value AT the boundary and the value just before and
after the lower the boundary.
In the previous example, using three-point boundary values, for the valid partition the
lower boundary test values are 19, 20, 21 and the upper boundary test values are 49,
50, 51.
In the exam, they will state it clearly that they want you to calculate the test values
using 3-point boundary value analysis.
If they didn’t indicate which technique to use, then consider 2 value BVA.
So, To solve the BVA questions rights you must identify the partitions correctly and
identify the boundaries of each partition
Your test cases should use the exact boundaries you have just identified
Boundary value analysis can be applied at all test levels.
This technique is generally used to test requirements that call for a range of numbers
(including dates and times).
Boundary coverage for a partition is measured as the number of boundary values tested, divided
by the total number of identified boundary test values, generally expressed as a percentage.
So considering 2-point BVA.
In our employee age example, we agreed that we have the following boundaries 0, 19, 20,
50, 51 … so we have 5 boundaries If the testers decided to consider 3 boundaries
only in his designed test cases then the coverage is 3/5 x 100 = 60%
Let’s look at a more complicated BVA example to confirm our understanding
Again, you need to be very careful with the wording of the question.
All what we need to do is define the partitions correctly with its boundaries.
The question didn’t specify if we should use 2-point BVA or 3-point BVA so we can consider
2-point BVA.
So looking at the question, Bank fee is 0% for balance less than 500 US$...
What will be the boundaries for this partition?
Yes, we will start from Zero.. but what will be the higher boundary in this partition?
Notice that it says here less than 500 so in that case 499$ or to be more accurate 499.99$
will be the higher partition for this one.
Again, wordings are the tricky part in this kind of questions so from 0 to 499.99 we will
have 0% bank fee.
The following partition will start from 500 and again looking at the question we will
pay 2% for less than 1000$ so what will be the upper boundary for this partition?
yes, it'll be 999.99 The third partition will be from 500 to 999.99.
The following partition is from 1000 or more so from 1000 up to infinity we will pay 4%
bank fee.
Looking at the question itself, what are they actually looking for?
They are looking for valid boundary analysis so we are just defining the valid boundaries
here so we have three partitions from 0 to 499.99 and the second one from 500 to 999.99
and the third partition from 1000 to infinity so which choice is ours?
Actually this is the simplest part of BVA questions once you have defined the partitions
correctly and the boundaries precisely then the answer is just in front of your eyes right
now for valid BVA, I will just say it without looking at any of the choices it'll be 0,
499.99, 500, 999.99, 1000.
The numbers that you wrote with your own hands are the correct choices.
So looking at the answer options, we can simply discard choice C because it contains a negative
value and we are looking only for valid boundary values.
Choice D seems very small it doesn't contain any 499 values so we can also discard choice
D from our list.
Looking at choice A, we notice that it has many test inputs 0, 0.01, 499.99 and so on.
So choice A is not correct.
When we were driving our test cases we used the 2-point BVA technique … if the question
asked for 3-point BVA the answer would be choice A … but choice A is there to confuse
you … so remember they usually ask exactly if they want 3-point value….
Actually if choice if we examined choice B and it turned out to be incorrect as well
… then we can pick choice A here … so even though they haven’t directly asked
for 3-point BVA … but if the only correct answer was the 3-point BVA values then be
it … we’ll not pick wrong values anyways.
Saying that, looking at the values of option B…
0.00 yes, 499.99 yes, 500.00, 999.99 and 1000.00.
So after examining the values of choice B. the correct answer should be choice B
again, those kind of questions are very tricky in the wording so we have to be very relaxed
while reading the words Use your pencil or pen or whatever just to go through the question
.. word by word and draw the boundaries as I did and the numbers will just pop up in
front of your eyes very smoothly.
I hope you got the idea of those kinds of questions Thank you