Boundary-value analysis is a software testing technique in which tests are designed to include representatives of boundary values in a range. The idea comes from the boundary. Given that we have a set of test vectors to test the system, a topology can be defined on that set. Those inputs which belong to the same equivalence class as defined by the equivalence partitioning theory would constitute the basis. Given that the basis sets are neighbors, there would exist a boundary between them. The test vectors on either side of the boundary are called boundary values. In practice this would require that the test vectors can be ordered, and that the individual parameters follows some kind of order (either partial order or total order). Formal definition Formally the boundary values can be defined as below: Let the set of the test vectors be . Let's assume that there is an ordering relation defined over them, as . Let be two equivalent classes. Assume that test vector and . If or then the classes are in the same neighborhood and the values are boundary values. In plainer English, values on the minimum and maximum edges of an equivalence partition are tested. The values could be input or output ranges of a software component, can also be the internal implementation. Since these boundaries are common locations for errors that result in software faults they are frequently exercised in test cases. Application The expected input and output values to the software component should be extracted from the component specification. The values are then grouped into sets with identifiable boundaries. Each set, or partition, contains values that are expected to be processed by the component in the same way. Partitioning of test data ranges is explained in the equivalence partitioning test case design technique. It is important to consider both valid and invalid partitions when designing test cases. The demonstration can be done using a function written in Java. class Safe { static int add(int a, int b) { int c = a + b ; if (a >= 0 && b >= 0 && c < 0) { System.err.println("Overflow!"); } if (a < 0 && b < 0 && c >= 0) { System.err.println("Underflow!"); } return c; } } On the basis of the code, the input vectors of are partitioned. The blocks we need to cover are the overflow statement and the underflow