Identifying the Equivalence Classes
The equivalence classes are identified by
taking each input condition (usually a sentence or phrase in
the specification) and partitioning it into two or more
groups. You can use the table in Figure 3 to do this. Notice
that two types of equivalence classes are identified: valid
equivalence classes represent valid inputs to the program, and
invalid equivalence classes represent all other possible
states of the condition (i.e., erroneous input values). Thus,
we are adhering to the principle that stated that you must
focus attention on invalid or unexpected conditions.
Given an input or external condition,
identifying the equivalence classes is largely a heuristic
process. A set of guidelines is as follows:
- If an input condition specifies a range of values (for
example, "the item count can be from 1 to 999"), identify
one valid equivalence class (1 < item count < 999) and
two invalid equivalence classes (item count < 1 and item
count > 999).
- If an input condition specifies the number of values
(for example, "one through six owners can be listed for the
automobile"), identify one valid equivalence class and two
invalid equivalence classes (no owners and more than six
owners).
- If an input condition specifies a set of input values
and there 54 The Art of Software Testing Figure 4.3 A form
for enumerating equivalence classes. External condition
Valid equivalence classes Invalid equivalence classes is
reason to believe that the program handles each differently
("type of vehicle must be BUS, TRUCK, TAXICAB, PASSENGER, or
MOTORCYCLE"), identify a valid equivalence class for each
and one invalid equivalence class ("TRAILER," for example).
- If an input condition specifies a "must be" situation,
such as "first character of the identifier must be a
letter," identify one valid equivalence class (it is a
letter) and one invalid equivalence class (it is not a
letter).
If there is any reason to believe that the program does not
handle elements in an equivalence class identically, split the
equivalence class into smaller equivalence classes. |