Equivalence class formation

A part of a value area in which similar behavior of SUT (system under test) is assumed is defined as an equivalence class. This assumption is based as a rule on requirements or other sources.

Equivalence classes can be determined both for possible entries and the results of a SUT:

  • A specific example of an input equivalence class can be for example an age of 0 to 5 years, as regards determining fare prices.

  • In this example price ranges form equivalence classes. In addition, an error message can also be an output equivalence class.

In the case of equivalence classes there is a differentiation between valid and invalid equivalence classes:

  • If a value from an invalid equivalence class is used as an entry, this value is expected to be processed properly.

  • On the other hand, if a value from an invalid equivalence class is entered, the processing is expected to be aborted and an error message e.g. is sent.

A test analyst uses equivalence class creation in order to cover every equivalence class through a test case in as much as possible.

A completely correct value from an equivalence class is described as a representative. Once equivalence classes are found, a check is run among value ranges for overlaps or gaps:

  • For an overlap there must be at least one value representing at least two equivalence classes. This is not desired as it is not clear which behaviour should be shown by the system.

  • In the case of a gap, there must be at least one value that is not contained in any equivalence class. System behavior is thus unclear for this value as an equivalence class is mis­sing.

In order to evaluate test coverage the measure of equivalence class coverage is used. The value stands for the quotients from the number of equivalence classes used in the test and all defined equivalence classes. The value is specified as percentage.

As regards equivalence classes, a good test should reach a coverage of 100%.