Boundary Value Analysis and Equivalence Partitioning both are test case design strategies in Black-Box Testing.
Equivalence partitioning
Equivalence partitioning or equivalence class partitioning (ECP) is a software testing technique that divides the input data of a software unit into partitions of equivalent data from which test cases can be derived. In principle, test cases are designed to cover each partition at least once.
In this method, the input domain data is divided into different equivalence data classes. This method is typically used to reduce the total number of test cases to a finite set of testable test cases, still covering maximum requirements.
Example: Employees with salary from 5 to 10 lacs
As the values from 6 to 10 are valid ones, one of the values among 6,7,8,9 and 10 has to be picked. Suppose you select 8, Hence, the selected value “8” is a valid input for the group between (Salary >5 lacs and <=10 Lacs).
For Example, If you are testing for an input box accepting numbers from 1 to 1000 then there is no use in writing thousand test cases for all 1000 valid input numbers plus other test cases for invalid data.
Using the Equivalence Partitioning method above test cases can be divided into three sets of input data called classes. Each test case is representative of a respective class.
So in the above example, we can divide our test cases into three equivalence classes of some valid and invalid inputs.
Test cases for input box accepting numbers between 1 and 1000 using Equivalence Partitioning:
#1) One input data class with all valid inputs. Pick a single value from range 1 to 1000 as a valid test case. If you select other values between 1 and 1000 the result is going to be the same. So one test case for valid input data should be sufficient.
#2) Input data class with all values below the lower limit. I.e. any value below 1, as an invalid input data test case.
#3) Input data with any value greater than 1000 to represent the third invalid input class.
Equivalence Partitioning uses fewest test cases to cover maximum requirements.
Boundary-value Analysis:
Boundary Value Analysis’ Testing technique is used to identify errors at boundaries rather than finding those that exist in the center of the input domain.
Boundary Value Analysis is the next part of Equivalence Partitioning for designing test cases where test cases are selected at the edges of the equivalence classes.
Test cases for input box accepting numbers between 1 and 1000 using Boundary value analysis:
#1) Test cases with test data exactly as the input boundaries of input domain i.e. values 1 and 1000 in our case.
#2) Test data with values just below the extreme edges of input domains i.e. values 0 and 999.
#3) Test data with values just above the extreme edges of the input domain i.e. values 2 and 1001.
Boundary Value Analysis is often called as a part of the Stress and Negative Testing.
Note: There is no hard-and-fast rule to test only one value from each equivalence class you created for input domains. You can select multiple valid and invalid values from each equivalence class according to your needs and previous judgments.
