Equivalence Set Testing
Equivalence set (a.k.a., equivalence class)
testing is a black-box unit testing technique for
minimizing the number of test cases by creating a single test
case for each equivalence set of type values involved in an
interaction.
For any nontrivial class or use case, exhaustive testing is
impossible because a huge, practically infinite number of
choices of test values exist. Through analysis, one can
partition the associated state space into small number of
regions containing possible test values, each point in which
should produce qualitatively equivalent behavior if the class
or application is implemented correctly.
The typical objectives of equivalence set testing are
to:
- Minimize the number of test cases to develop and
maintain.
- Ensure that each major state of the item under test is
tested.
Equivalence set testing can typically begin when the
following preconditions hold:
- The tester(s) has been trained in equivalence set
testing.
- The item under test has been:
- Specified (use case path for testing application)
or
- Designed (interface and responsibilities for software
component or class).
Equivalence set testing is typically complete if the
following postconditions hold:
- For For each operation (e.g., use case path or class
method), one test case exists for each equivalence set of
relevant type values.
During equivalence set testing, unit and functional test
testers typically perform the following steps:
- Identify all object and data types involved in an
interaction.
- Identify all that have state models.
- Using the state models and any assertions involving the
interaction, decompose the complete state space of an
interaction (including input parameters, output values,
attributes, etc.) into a set of disjoint regions in a
multidimensional space. Each axis of the space represents a
single object type involved in the interaction. All
combinations of relevant data type values should produce the
same qualitative behavior of the object under test.
- Select a point within the equivalence set of relevant
type values.
- Create a test case from the type values of each
representative point.
Equivalence set testing typically results in the following
work products:
- Test suites containing one test case for each equivalence
set.
Equivalence set testing is typically subject to the
following limitations:
- In order to minimize the number of test cases, this
testing technique assumes that all combinations of relevant
type values within an equivalence set are equally likely to
cause failure. However, this assumption is based on the
assumption that the implementation of the class conforms to
its specification in that the equivalence sets identified
from the specification are actually equivalent as
implemented.
- If the implementation does not match the design as
specified (which it will not if a defect exists), then some
combinations of values in the equivalence set will produce a
different actual behavior than expected by the oracle.
Nevertheless, this technique still will elicit failures due
to many defects.
Guidelines
- Use equivalence set testing to identify your primary test
cases.
- Augment equivalence set testing with boundary value
testing and error guessing.