Equivalent Class Partitioning (ECP) and Boundary Value Analysis (BVA) are two Data-Input Techniques and both are quite beneficial in the Testing process.
When there is a large set of test data, there is no time to perform testing for each data-set and thus, we need some techniques which can filter out the test cases that cover all the test-case scenarios. And here, comes the role of these techniques, as we say- ECP and BVA.
‘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. On the other hand, Equivalence partitioning is a black-box testing technique that applies to all levels of testing. Most of us use it informally without even realizing it but there are defined rules and best practices that can make it more useful and scientific.
Let’s understand these techniques along with examples-
ECP reduces the Test Coverage and can be applied where we have to test with data. It divides data into various regions and we can select data according to region and test. It is typically used to reduce the number of test-cases. It saves time for testing.
ECP divides data into Two regions first is a valid region & the second one is the invalid region. These regions can increase & decrease according to data. When we divide data into regions, then we can choose over test data from the valid region. The invalid region can be rejected or minimal data will be chosen from it.
We can understand ECP using an example. We will just use a password field. This field can accept a password of length 1 to 12.
We will divide it into three regions. The first region will be a valid region. It will have a length between 1 to 12. The second will be an invalid region and it will have data range below length 1. The third region will be an invalid region and it will have data range above length 12.
See the diagram below-
Then test data will be the length of between 1 to 12 only. So valid password length can be from1 to 12 only. Another length will be invalid.
We can see another example as well. We have an input field accepts the number between 1 to 100 only. The field name is App Id. The screen will look like-
We will divide it into three regions. The first region will be a valid region. It will have no. between 1 to 100. The second will be an invalid region and it will have a number below length 1. The third region will be an invalid region and it will have no. between 100 & 1000. We can have the fourth region as well. It will be an invalid region and have a number above 1000.
Then test data will be numbered between 1 to 100 only. So valid App Id can be from 1 to 100 only. Another number will be invalid.
BVA technique reduces Test Coverage and picks data on the boundary of various regions/classes of ECP. We can choose Data on the boundaries of classes.
It is a subset of ECP. While ECP divides data into Two regions, these regions can increase & decrease according to data. When we divide data into the region then we can choose over test data from the valid region. The invalid region can be rejected but in BVA, we will look for data on the boundaries of these regions. Data can be picked just on the boundary, below the boundary, above the boundary, and between boundaries.
We can understand BVA using examples. We will just use examples of ECP so that we can differentiate between ECP & BVA. We are taking the same password field. This field can accept a password of length 1 to 12.
It will have three regions as mentioned in ECP. Two invalid regions & one valid region.
But in BVA, we have to choose from boundaries. The diagram will be-
So, password length can be chosen 0,1,12,13. On boundaries, the length is 1 & 12. Just below & above boundaries length are 0 & 13. Between boundaries, we can choose any length. Here we have chosen length of 5.
So, a total of five test cases can be written over it.
We have three positive test cases from the valid region and two negative test cases from the invalid region.
We can understand it further using another example of ECP. We will use the same App ID field. The screen will be-
It will have four regions just as mentioned in ECP. Three invalid regions & one valid region.
But in BVA, we have to choose from boundaries then the diagram will be-
So, App ID can be chosen 0,1,100,101. On boundaries, App ids are 1 & 100. Just below & above boundaries App Ids are 0 & 101. Between boundaries, we can choose any App Id. Here we have chosen 49.
So, a total of five test cases can be written for it.
We have three positive test cases from the valid region and two negative test cases from the invalid region. We can also choose App ID from another invalid region.
For any data we apply BVA or ECP, we must divide it into classes. We can decide which is the valid class for test coverage and which is an invalid class. It will save time. Then we must pick data on boundaries & nearer to boundaries. We can also choose some data set from an invalid class also. It depends on our requirements.
Hope you well understood about the BVA and ECP testing techniques and why there so beneficial in testing process.
Your feedback is most welcomed in the comments section. Thanks for Reading!!