Test Oracles — Knowing the Right Answer
You apply SAVE10 to a Basketly cart worth ₹600 and the total shows ₹540. Pass or fail? You can only answer because you know the rule: 10% off carts of ₹500 or more. Take the rule away and the screen tells you nothing. Whatever tells you the right answer is called an oracle.
The rule
No expected result, no test: an oracle says what is right.
A test oracle is any trusted source you use to decide whether an actual result is correct. Running software is easy; judging it is the hard part, and the oracle is what makes the judgement possible.
Common oracles, with a Basketly example for each:
| Oracle | Basketly example |
|---|---|
| Specification | The story says SAVE10 gives 10% off from ₹500 |
| Calculation | ₹600 × 0.9 = ₹540, worked out by hand |
| Previous version | The old checkout showed the same total for the same cart |
| Comparable product | Other grocery apps round to the nearest paisa the same way |
| Consistency | Prices in search match prices in the cart |
| Human judgement | The product owner looks and says "yes, that's what I meant" |
No oracle is perfect. A specification can be wrong, an old version can have the same bug, and a human can misremember. Good testers use more than one oracle for anything important, and notice when two oracles disagree, which is often where the bug lives.
The shortcut
Before running any test, finish this sentence out loud: "I expect ___, because ___." The first blank is the expected result; the second blank is your oracle. If you cannot fill the second blank, you are exploring, not testing yet.
Fill the first blank
"I expect no discount, so the total stays ₹480..."
The trap is judging by "looks fine". A total of ₹432 looks perfectly reasonable on screen; only an oracle reveals it is wrong.
Drills
Answer fast — trust the rule.
What is a test oracle?
You check that a product's price in search matches its price in the cart. Which oracle is that?
The spec says delivery is free above ₹300, but the product owner says ₹350. What should you do?
Why is "the old version did the same thing" a weak oracle on its own?
A tester cannot finish "I expect ___, because ___" for a new screen. What are they doing?
Remember
- No expected result, no test: an oracle says what is right.
- Say "I expect ___, because ___" before every check.
- Oracles can be wrong; when two disagree, raise it.
