Boundary Values: Order Total Discount
Equivalence partitioning and boundary value analysis on a three-product cart with an order total discount.
Requirements
- The cart has three products: Pen — 1 €, Book — 15 €, Headphones — 120 €. Each product has a Quantity field, 0 by default. The quantity can be typed in or changed by 1 with the “−” and “+” buttons; “−” does not go below 0.
- Order total is shown under the products. It is recalculated whenever a quantity changes. While any quantity is invalid, “—” is shown instead of the total.
- A quantity is a whole number from 0 up. An empty field gives the error “Quantity is required”, text gives “Quantity must be a number”, a fractional number (for example, 1.5) gives “Quantity must be a whole number”, and a negative number gives “Quantity cannot be negative”. The error is shown under the field when you leave it or press Calculate.
- A valid order total is 1 to 1000 € inclusive. If the total is outside this range, pressing Calculate shows the error “Order total must be between 1 and 1000 €”.
- The discount depends on the order total:
- 1 to 99 € — no discount (Discount: 0%);
- 100 to 499 € — 10% off;
- 500 to 1000 € — 15% off.
- After Calculate is pressed, the discount percentage (Discount) and the amount to pay (To pay) are shown. When there is any error, no discount is calculated.
Task
- Identify the valid and invalid equivalence classes for the product quantity and for the order total.
- Pick one representative from each class.
- Find the boundaries and choose values to test: the boundary value and its two neighbours. For each total, build a cart that adds up to it.
- Test the app below and describe the bugs you find: input, expected result, and actual result.
Application under test
Cart
Discount:
To pay:
Quick reference
Equivalence partitioning
Input data is split into groups (classes) in which the system behaves the same way. One value per class is enough: if it works, the other values in the class most likely work too. Classes can be valid (acceptable data) or invalid (unacceptable data).
Boundary value analysis
Bugs most often hide at the edges of ranges, for example when “<” and “≤” are mixed up in a condition. So you test the boundary value itself and the nearest value on the other side of the boundary.