We want a sense of complete functional testing and to avoid redundancy. Equivalence classes are a partition of the input set according to specification.
A class is expected to behave the same way, be mapped to similar outputs, test the same thing, reveal the same bugs.

It is difficult in practice to find perfect equivalence classes.

Once they are found, test cases can be generated.

Weak Equivalence Class Testing

  • Choose one variable value from each equivalence class

Strong Equivalence Class Testing

  • Based on the cartesian product of the partition subsets (i.e test all the class interactions)

From combinations of EC’s make test cases (strong or weak depending on coverage).
We also want to consider invalid ECs and make test cases from these.

Heuristics

For each external input:

  1. If input is a range of valid values, define 1 valid EC and 2 invalid ECs
  2. If input is a number of valid values, define 1 valid EC and 2 invalid ECs (none more than N)
  3. If input is an element from a set of valid values, define 1 valid EC and 1 invalid EC
  4. If input is a conditional, define 1 valid EC and 1 invalid EC
  5. If there is a reason to believe that elements in an EC are not handled in an identical manner by the program, subdivide into smaller ECs
  6. Consider creating equivalence partitians that handle the default, empty, blank, null, zero, and none conditions

Test Selection

  • Write new test cases that cover as many of the uncovered valid ECs as possible until all valid ECs have been covered
  • Write new test cases that covers one and only one uncovered invalid EC until they all have been uncovered

Equivalent Partitioning

Pros

  • Small number of test cases needed
  • Probability of uncovering defects with the selected test cases higher than that with a randomly chosen test suite of the same size Cons
  • Strongly typed languages eliminate the need for the consideration of some invalid inputs
  • Specification does not always define expected output for invalid test cases
  • Test selection does not work well when input variables are not independent
  • Brute force definition of test cases for every combination of the inputs provides good coverage but is impractical