Equivalence Class Partitioning

What is equivalence class partitioning?

Equivalence class partitioning is a black-box testing technique (or specification based testing technique) in which we group the input data into logical groups or equivalence classes. All the data items lying in an equivalence class are assumed to be processed in the same way by the application when passed as input.

Example

Consider an example of an application that accepts a numeric number as input with value between 10 to 100 and finds its square. Now, we can create the following equivalence classes of the input-

Equivalence class partitioning
  • 10 to 100 - A valid equivalence class with acceptable numeric numbers
  • Greater than 100 - An invalid equivalence class containing integer values greater than 100
  • Less than 0 - An invalid equivalence class with negative numbers
  • Between 0 to 1 - An invalid equivalence class with decimal numbers
  • Alphanumeric characters - An invalid equivalence class with alphanumeric characters for checking the robustness of application
  • Special characters - An invalid equivalence class with special characters

Advantages of equivalence class partitioning

  1. Having equivalence classes greatly reduces the number of test cases without compromising the test coverage or quality of testing.
  2. It helps in reducing the overall test execution time due to reduced set of test data.
  3. It is higly used in cases where exhaustive testing is not possible but at the same time test good coverage needs to be maintained.

Disadvantages of equivalence class partitioning

  1. The identification of equivalence classes relies heavily on the expertise of the tester. Having incorrectly identified equivalence classes leads to higher risk of defect leakage and less test coverage.
  2. The equivalence classes needs to be partitioned just to the right amount and groups as having too large partitions leads to risk of missing defects. Whereas, partitioning into more groups of smaller sizes leads to redundant tests.