What is Equivalence class partitioning testing

  • by

Equivalence class partitioning testing is a method of black box testing which divides the input data of a program into equal partitions or classes or groups that can be considered the same and equivalently.

Equivalence class partitioning also called as Equivalence partitioning or ECP.

In ECP test cases are designed to cover each class at least once.

It is used to design test cases to expose the classes of errors and therefore it help to reduce the test cases.

Due to less number of test cases it reduces the time to perform testing.

It can be used any level of testing viz. unit, integration and system testing.

It has to be complement by boundary value analysis to applied effective test cases for partitions.

It is based on an evaluation of equivalence partitions, classes or groups for an input condition and may be for output conditions.

It represents set of valid and invalid values for input condition and input condition is either in numeric value, range value and Boolean conditions.

Equivalence class partitioning can be defined according to the following specifies guidelines -:
– For specific numeric input value, one valid and two invalid equivalence classes are defined.
– For range value, one valid and two invalid equivalence classes are defined.
– For Boolean value, one valid and one invalid class are defined.

Equivalence class partitioning plays important role for large number of data sets

Example of ECP -:
Consider making a group on social network site, user can add 1 to 49 members only to chat with each other. If group count in between 1 to 49 are considered valid and made group, while we add less than and greater than 49 are considered invalid and couldn’t make a group (error message will appear).

In the above example we can not test for all possible group count if done, number of test cases will be generated more. To address this problem, we can use equivalence class partitioning where we divide into possible class and test conditions are as -:
1. Group count in between 1 to 49 are considered valid
2. Group count less than 1 is considered invalid
3. Group count greater than 49 is considered invalid

Valid Partitioning Invalid Partitioning
1 to 49 (Within class)

0 (Less than 1),

50 (Greater than 49)

Benefits of equivalence class partitioning -:
1. Helps to reduce test cases
2. Focus on small data set and uncover more defects

Leave a Reply