Course outline
Equivalence partitioning tool
List the classes of each input; it writes the fewest cases that use every class, and one case for each invalid class.
An input can take more values than anyone could test. Equivalence partitioning splits them into classes the system should treat the same way: test one value of a class, and you have tested them all. A quantity of 3 and a quantity of 7 travel the same path through the code; 0 and 11 each take another.
List each input with its classes, the valid ones (the system must accept them) and the invalid ones (it must refuse them), with an example value for each. The tool writes the fewest test cases that use every valid class, and one case for each invalid class.
Use the tool
An input on its own line; under it "+ class = example" for a valid class and "- class = example" for an invalid one.
2 valid cases and 6 invalid cases.
| Case | Quantity | Coupon code | Covers |
|---|---|---|---|
| V1 | 3 | (empty) | Quantity: 1 to 10; Coupon code: no code |
| V2 | 3 | CEDAR10 | Quantity: 1 to 10; Coupon code: a valid code |
| Case | Quantity | Coupon code | Covers |
|---|---|---|---|
| I1 | 0 | (empty) | Quantity: below 1 |
| I2 | 11 | (empty) | Quantity: above 10 |
| I3 | two | (empty) | Quantity: not a number |
| I4 | 3 | EXPIRED24 | Coupon code: expired |
| I5 | 3 | SPRING25 | Coupon code: used up |
| I6 | 3 | HELLO10 | Coupon code: unknown |
How the method works
Valid classes can share a test case: a case with 3 copies and the code CEDAR10 checks a valid quantity and a valid code at once. Using every class at least once in as few cases as possible is called each-choice coverage, and it is what the valid cases here do.
Invalid classes must not share. If one case had both 0 copies and an expired code, a refusal would not tell you which of the two caused it, or whether both are checked at all. So each invalid class gets a case of its own, and every other input in that case keeps a valid value.
- Write each input's name on its own line.
- Under it, one line per class: "+ name = example" for a valid class, "- name = example" for an invalid one; "(empty)" for an empty value.
- Run every case: the valid ones must work, each invalid one must be refused for its own reason.
A worked example on Cedar Books
Cedar Books takes 1 to 10 copies of a book (REQ-05) and one coupon code, which can be valid, expired, used up or unknown (REQ-03, REQ-06). The tool turns those classes into two valid cases and six invalid ones:
| Case | Quantity | Coupon code | Covers |
|---|---|---|---|
| V1 | 3 | (empty) | Quantity: 1 to 10; Coupon code: no code |
| V2 | 3 | CEDAR10 | Quantity: 1 to 10; Coupon code: a valid code |
| Case | Quantity | Coupon code | Covers |
|---|---|---|---|
| I1 | 0 | (empty) | Quantity: below 1 |
| I2 | 11 | (empty) | Quantity: above 10 |
| I3 | two | (empty) | Quantity: not a number |
| I4 | 3 | EXPIRED24 | Coupon code: expired |
| I5 | 3 | SPRING25 | Coupon code: used up |
| I6 | 3 | HELLO10 | Coupon code: unknown |
Two valid cases cover the three valid classes; each of the six invalid cases changes one input only, so the message the shop shows must match that one cause. Boundary value analysis then picks the exact edges of the quantity classes.