# What Is Boundary Value Analysis & ECP – Explained With Examples

Boundary Value Analysis and Equivalence Class Partitioning are the most common technique in Black-box Testing Techniques for test case design. Both are used to design test cases for validating a range of values for any given input domain. Both these techniques are used together at all levels of testing.

Exhaustive testing is not possible in all cases. So, a tester should concentrate on validating at least one value from a data set to find out the possible errors, if any.

## WHAT IS BOUNDARY VALUE ANALYSIS?

Boundary Value Analysis (BVA) is a Black-Box testing technique used to check the errors at the boundaries of an input domain.

The name comes from the Boundary, which means the limits of an area. So, BVA mainly focuses on testing both valid and invalid input parameters for a given range of a software component.

If (Min,MAX) is the range given for a field validation, then the boundary values come as follows:

Invalid Boundary Check   { Min-1 ; Max+1 }

Valid Boundary Check   {Min; Min+1 ;Max-1;Max }

## Example of Boundary Value Analysis :

Requirement: Validate AGE field, which accepts values from 21-60.

We verify the following Boundary Value Test cases:

TC001: Validate AGE by entering  20 [ Min-1]: Invalid Boundary Check

TC002: Validate AGE by entering  21 [ Min]: Valid Boundary Check

TC003: Validate AGE by entering  22 [ Min+1]: Valid Boundary Check

TC004: Validate AGE by entering  59 [ Max-1]: Valid Boundary Check

TC005: Validate AGE by entering  60 [ Max-1]: Valid Boundary Check

TC006: Validate AGE by entering  61[ Max+1]: Invalid Boundary Check

The main advantage of Boundary Value Analysis is that the testing time is less as the tester will analyze the data only at the boundaries.  Since this technique cannot concentrate on the errors that exist in the center of the input domain, it is always advisable to use BVA with a combination of Equivalence Class Partitioning.

## EQUIVALENCE CLASS PARTITIONING (ECP) :

Unlike Boundary Value Analysis, in Equivalence Class Partitioning, the input domain values are partitioned into equivalent classes. It validates at least one value from each partition. So, the test cases are designed to cover at least one set of data from each equivalent class. Thus, it reduces the number of test cases.

In other words, ECP concentrates on the possible errors at the center of the input domain instead of the boundaries.

Example: An online pharmacy website has the following offers for its customers.

If the cost of the medicines is  \$1 – \$25, then a 0% discount

If the cost of the medicines is \$26 – \$ 50, then a 5% discount.

10% discount  if the cost is \$51 – \$100. A 15% discount, if the price is more than \$ 100.

Here, the Equivalence Classes divides the following into valid/invalid cases.

 Equivalence Classes Input Value Valid/Invalid x  <   \$1 0.05 INVALID \$1   <= x <=   \$25 20 VALID \$26   <= x <=   \$50 35 VALID \$51  <= x <=   \$100 78 VALID x  >  \$100 150 VALID