# Boundary Value Analysis - When to use two value or three value?

I had a few questions regarding boundary value analysis that I was hoping someone could help me with.

The first is - when should you assume to use two and three value methods of BVA? Is there any actual distinction as to when you should use one or the other, or does it depend on the specific question asked (in terms of an examination) and I would simply need to just know how to use both? Is there a default method to use?

Secondly, consider this possible question:

A smart home app measures the average temperature in the house and provides feedback to the occupants for different average temperature ranges:
• Up to 10 C – Icy cool!
• 11 C to 15 C - Chilled out!
• 16 C to 19 C - Cool man!
• 20 C to 22 C –Too warm!
• Above 22 C - Hot and Sweaty!
Apply 3 point BVA to the above temperature ranges. How many test cases would you consider?

``````The answer that was provided was that:
For 10 - we would test 9, 10, 11.
For 11 - we would test 10 (already tested), 11 (already tested), 12
For 16 - we would test 15, 16, 17
For 20 - we would test 19, 20, 21
For 22 - we would test 21 (already tested), 22, 23
This would result in a a total of 12 test cases.
``````

Can somebody please explain to me as to why we would test the upper boundary in the first partition (10 degrees), but not the upper boundaries in other valid partitions (such as 15, which would lead to us testing 14,15,16 or 19 leading to testing 18,19,20). Is this because the boundary of 10 is the only boundary within that partition, as the lower boundary is open?

• 0 C to 10 C – Icy cool!
• 11 C to 15 C - Chilled out!
• 16 C to 19 C - Cool man!
• 20 C to 22 C –Too warm!
• 23 - 40 C - Hot and Sweaty!

Would the values that are tested then change to the below? Would we still need to test the upper boundary in the first partition, or would we now ignore this as we have a lower boundary value?

``````For the lower invalid partition -2, -1, 0
For the first valid partition: -1, 0, 1
For the second valid  partition:   10, 11, 12
For the third valid  partition:   15, 16, 17
For the fourth valid  partition:   19, 20, 21
For the fifth valid  partition:   22, 23, 24
For the upper invalid partition: 40, 41, 42
``````

Thank you in advance - I think I have been over complicating things in my head and wracking my brain over this!

Welcome to the site.

If I'm not mistaken, your question is based on some exam you're taking/considering taking? It's very similar to ISTQB exams in software testing. I'm asking because it seems important. The questions themselves as stated are simply imcomplete, there's not a bit mentioned about risk, so it's hard to answer how to test it. On the other hand, if you want to pass such exams (me included in the past), you need to learn how to answer such questions.

I'll take it even further and ask why the "correct" answer considered only integers. As far as I know, floats are much more common representations of temperature. So why are you not testing values like 9.9, 10, 10.1, or even 9.99, 10, 10.01. I can go on and on here and I'll be always right. So again, it depends on expectations of the product, specifications, risk. None of these are included in the question.

By looking at the results, I'd say they combined that with partition testing. If you already test a value inside one range, you don't need to test another value from the same range. In this way, you'd leave out 14 because you already tester 12. Both are in the same range. But you still need to test 15 because that's exactly between the two ranges. Another (maybe even better when I think about it now) exaplanation would be that you don't test 14 because if your test for 15 passes (shows Chilled out!), than it'd be same for 14 because it's even a lower number and you don't expect some other factors that might mess up the result. I guess they consider that the biggest danger here is that a developer writes `if temperature >= 11 and temperature < 15`, which is wrong for your second partition, but it still passes for 14. So they sort of take for granted that the developer at least got the numbers right and might have messed up only the operators :D

As for your second question with changed intervals. Following on the logic outlined in the previous paragraph, I'd test:

``````0 C to 10 C – Icy cool!: -1, 0, 1
11 C to 15 C - Chilled out!: 10, 11, 12
16 C to 19 C - Cool man!: 15, 16, 17
20 C to 22 C –Too warm!: 19, 20, 21
23 - 40 C - Hot and Sweaty!: 22, 23, 24, 40, 41
``````

Values -2, 42 seem duplicate to -1 and 41, and you test values -1 and 0 twice, so you make duplicate test cases.

I'm not 100 % sure about what's the correct answer in the exam, I rather tried to show how I'd think about this problem in the real world.

EDIT:

I've decided to edit my post a bit to include more information.

For three value boundary testing, the values before, on and over the boundary are used.

Based on this, I think the first question should be answered like this:

``````Up to 10 C – Icy cool!: 9, 10, 11
11 C to 15 C - Chilled out!: 12, 14, 15, 16
16 C to 19 C - Cool man!: 17, 18, 19, 20
20 C to 22 C –Too warm!: 21, 22, 23
``````

However, that's not the same answer as was mentioned as the "correct" one in the initial question. So they either forgot to mention some values or they used some other logic to eliminate some values. However, I can only repeat that knowing an increment is important in such situation, you can read more here.

• Hi, thank you for your response. This is for a university exam based on the ISTQB spec. Regarding the question regarding changed intervals, I see that you treat 0 and 40 as the boundarys. Is there a situation where you would ever treat the first invalid partition value as the boundary (in this case, -1 or 41). Do you not test 39 for the 40 boundary because it repeats an already tested partition? I think for the exam I would need to include it, though. – Jordan Dec 15 '19 at 16:23
• Strictly speaking, based on ISTQB manuals e.g. here istqb.org/downloads/category/7-advanced-level-documents.html, three value BVA is For three value boundary testing, the values before, on and over the boundary are used. So first of all, your questions don't mention the increment, that's what I mentioned by the integer/float part. Second of all, if we take it literally, you take every boundary and test for value just before, on, and just over the boundary. So in your example, it'd be -1, 0, 1, 9, 10, 11, 12, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 39, 40, 41. – pavelsaman Dec 15 '19 at 20:24