Boundary value analysis is a technique to test boundary value between valid and invalid partitions in test case design. let’s see what has to say about Boundary value analysis and Equivalence partitioning first!
In this article we will discuss some basic test design techniques used to create better test cases, particularly Boundary value analysis and Equivalence partitioning and how these are used in actual testing.
Following a brief explanation, it will become easy for you to understand how test cases are designed based upon these techniques.
Dividing the test input data into a range of values and selecting one input value from each range is called Equivalence Partitioning. This is a black box test design technique used to calculate the effectiveness of test cases and which can be applied to all levels of testing from unit, integration, system testing and so forth.
We cannot test all the possible input domain values, because if we attempted this, the number of test cases would be too large. In this method, input data is divided into different classes, each class representing the input criteria from the equivalence class. We then select one input from each class.
This technique is used to reduce an infinite number of test cases to a finite number, while ensuring that the selected test cases are still effective test cases which will cover all possible scenarios.
Let’s take a very basic and simple example to understand the Equivalence partitioning concept:
If one application is accepting input range from 1 to 100, using equivalence class we can divide inputs into the classes, for example, one for valid input and another for invalid input and design one test case from each class.
In this example test cases are chosen as below:
- One is for valid input class i.e. selects any value from input between ranges 1 to 100. So here we are not writing hundreds of test cases for each value. Any one value from this equivalence class should give you the same result.
- One is for invalid data below lower limit i.e. any one value below 1.
- One is for invalid data above upper limit i.e. any value above 100.
Boundary value analysis:
For the most part, errors are observed in the extreme ends of the input values, so these extreme values like start/end or lower/upper values are called Boundary values and analysis of these Boundary values is called “Boundary value analysis”. It is also sometimes known as ‘range checking’.
Boundary value analysis is another black box test design technique and it is used to find the errors at boundaries of input domain rather than finding those errors in the center of input.
Equivalence Partitioning and Boundary value analysis are linked to each other and can be used together at all levels of testing. Based on the edges of the equivalence classes, test cases can then be derived.
Each boundary has a valid boundary value and an invalid boundary value. Test cases are designed based on the both valid and invalid boundary values. Typically, we choose one test case from each boundary.
Finding defects using Boundary value analysis test design technique is very effective and it can be used at all test levels. You can select multiple test cases from valid and invalid input domains based on your needs or previous experience but remember you do have to select at least one test case from each input domain.
Let’s take same above example to understand the Boundary value analysis concept:
- One test case for exact boundary values of input domains each means 1 and 100.
- One test case for just below boundary value of input domains each means 0 and 99.
- One test case for just above boundary values of input domains each means 2 and 101.