# How to write an equivalence class partition

The idea behind the equivalence partitioning test technique is to eliminate the set of input data that make the system behave the same and yield the same result when testing a program. Equivalence Partitioning is a common black box testing technique and aims to reduce the number of redundant test cases by eliminating those that generate the same output and do not necessarily reveal defects in a program functionality. As the aim of testing is to find defects, then a successful test case is the one that does find a defect.

Black Box Testing Methods In black box testing we don't have access to the internal mechanism of a component, so we are limited to providing input data and inferring correctness based on its externally observable behavior.

## Blog Archive

For any but the most trivial program, the number of potential input data items is often astronomical, making exhaustive testing impractical. So we need strategies for inventing tests that have a high likelihood of revealing a defect.

Two common techniques are Equivalence Class Partitioning and Boundary Value Analysis Equivalence Class Partitioning Suppose that we were going to test a program that reads an integer and prints the absolute value. Exhaustive testing would require testing with every possible integer value. For anything other than trivial programs like this one, the number of test cases can quickly become astronomical.

In addition, many of the tests would not be "good" tests in the sense that they don't have a high likelihood of revealing a defect. One strategy for inventing tests that will give us the most "bang for the buck" involves identifying a small set of representative input values that invoke as many different input conditions as possible.

## § 2 Equivalence Relations

Equivalence Partitioning divides the input domain of a program into classes of data from which test cases can be derived. The theory says we only need to create one test case for each "class" of input data.

The intent is to define a representative or "power" test case that uncovers a class of errors, thereby reducing the total number of test cases that must be developed.

If the absolute value function produces the correct result for input ofis there any reason we would expect it to fail for ? These two values are candidates to be in the same equivalence class. In one case, the absolute value is the negative of the input, while in the other case, the output is the same as the input.

## Equivalence Relations

These two values should definitely be in different equivalence classes. Thus, for the absolute value function, we define three equivalence classes: Rules for Creating Equivalence Classes The following guidelines are applied to assist in defining equivalence classes: Age is a number from 1 - The idea behind this technique is to divide (i.e.

to partition) a set of test conditions into groups or sets that can be considered the same (i.e. the system should handle . Equivalent classes play an important role as we will see in the next theorem.

De–nition (Partition) A partition of a set Sis a collection of non- empty, disjoint subsets of Swhose union is S. MAT Mathematical Structures Equivalence classes and partitions De nition: Suppose X and Y are sets.

If R X X is an equivalence relation it is customary to write x ˘y for (x;y) 2R. The set T x = fy 2X: x ˘ygis called the \equivalence class of x" (under ˘). It is customarily denoted by [x] (or [x]. Theorem: The set of all equivalence classes form a partition of X We write X/Rthis set of equivalence classes Example: Xis the set of all integers, and R(x,y) is the relation “3 divides.

For a, b ∈ S we will write a b,not Comment: Later we will begin to treat an equivalence class as a single mathematical object (rather than view it as a set). For example, in certain circumstances we will add and multiply equivalence classes.

An equivalence class is a subset whose elements are related to each other by an equivalence arteensevilla.com equivalence classes of a set under some relation form a partition of that set (i.e. any two are either equal or disjoint and every element of the set is in some class).

Equivalence Partitioning Testing