Monday, May 7, 2012

Boundary Value Analysis (BVA)

By pushing one to the limits, you can see a totally different behavior from that person. Stretching a system to extremes will bring out its funny behavior. Usually this is applicable to all fields on the user interface. Always remember, most of the problems to our body happens due to bad input, name it bad food, or bad water or bad air. Same way, a system if it accepts bad inputs, it is in potential danger zone.

Let us take a simple voltage stabilizer that we connect to TV or fridge. Usually they give the range 190-240 volts 50 to 60 hertz input, output will be constant at 220 volts. If this needs to be tested, we need to look at some good and bad extremes.

  1. Connect to 190 volts
  2. Connect to 240 volts
  3. Connect to 189 volts
  4. Connect to 241 volts
In the above, we arrived at 4 conditions - be at the lowest boundary, be at the highest boundary, go below the lowest boundary and go beyond the highest boundary. We just varied one parameter - voltage. 

But there is one more parameter we have - cycles in Hertz. For that, keep a valid voltage and push that cycles to extremes.
  1. Connect to 220 volts 50 Hz
  2. Connect to 220 volts 60 Hz
  3. Connect to 220 volts 49 Hz
  4. Connect to 220 volts 61 Hz
By doing this, we make the system to go thru positive boundaries and negative boundaries. Withing the positive boundaries, the system must work; the system must stop working when it is put under negative boundaries.

Better to apply one parameter and push that to extreme, when we deal with multiple parameters. Else if the system fails, we may not be able to isolate the reason of failure.

In software, imagine you see a field that takes the date of journey in a travel portal. How can we apply the BVA technique in that field? Ask these questions and take a call.

  1. Can I book a ticket for today?
  2. Can I book a ticket for yesterday?
  3. Can I book a ticket for a day 180 days from now? (usually travel sites may allow upto 6 months)
  4. Can I book a ticket for a day 181 days from now?

This list may go as per the restrictions given by that portal. Same way, let us take a US zip code field. How can I apply BVA on a zip code field? A zip code is usually 5 digits such as 95014 or 5 digits hyphen 4 digits such as 95014-2367.

A few home work questions for you to apply BVA.

  1. Write BVA tests for USA social security number
  2. Write BVA tests for the interest rate field in a banking simple interest calculation screen. (interest rate is a percentage value)
When you deal with boundaries, there are 2 kinds of boundaries. Size boundary and value boundary. Value boundaries are the ones we discussed before. Size boundary indicate the number of characters that I can type in a field. You could have seen that many websites registration pages restrict the passwords to be minimum 6 characters and maximum 10 characters. In such cases, we need to test for 5 character password, 6 character password, 10 character password and 11 character password. 

Now is the twist - if a field has both size and value boundaries defined, you end up doing at least 8 tests for that one field alone! Good luck.

For more details, please refer to Open Mentor portal.

1 comment:

  1. Thanks for the article.Here is one more example on this:

    Test cases for input box which accepts numbers between 1 and 100 using Boundary value analysis:

    Test cases with test data exactly as the input boundaries of input domain i.e. values 1 and 100 in our case.
    Test data with values just below the extreme edges of input domains i.e. values 0 and 99.
    Test data with values just above the extreme edges of input domain i.e. values 2 and 101.

    For more examples visit 5 Boundary Value Analysis Examples