Most production bugs in business software are not crashes. They are wrong answers: a discount applied when it should not be, a fee charged twice, a loan approved for someone who failed one of four conditions. These bugs live in the places where several conditions meet, and they survive because nobody wrote down every combination. A decision table is the simplest tool for doing exactly that.
Start with a rule that sounds simple
Imagine a food delivery app in Bengaluru with this delivery fee policy, written by a product manager in a single paragraph:
- Within 5 km, delivery is free for Gold members, and free for anyone whose order is ₹499 or more.
- Within 5 km, other orders pay ₹30.
- Beyond 5 km, Gold members pay ₹30 and everyone else pays ₹60.
Read it once and it feels clear. Now try to answer quickly: what does a non-Gold customer with a ₹650 order, 7 km away, pay? You have to stop and think. That pause is the signal that the rule has more combinations than the human brain tracks comfortably, and that a developer reading the same paragraph might implement a slightly different version of it.
Building the full table
A decision table has two halves. The top half lists conditions, each of which is true or false (or takes one of a small set of values). The bottom half lists actions, the outcomes the system should produce. Each column is one rule: a specific combination of conditions and the action that follows.
Here there are three yes/no conditions: is the customer Gold (G), is the order ₹499 or more (V), and is the distance 5 km or less (D). Three binary conditions give 2 × 2 × 2 = 8 combinations. Write them all out before thinking about which ones matter:
| Rule | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
|---|---|---|---|---|---|---|---|---|
| Gold member | Y | Y | Y | Y | N | N | N | N |
| Order ≥ ₹499 | Y | Y | N | N | Y | Y | N | N |
| Distance ≤ 5 km | Y | N | Y | N | Y | N | Y | N |
| Fee | Free | ₹30 | Free | ₹30 | Free | ₹60 | ₹30 | ₹60 |
The question from earlier is rule 6: non-Gold, big order, far away. The answer is ₹60, because the ₹499 threshold only matters within 5 km. Notice that the original paragraph never said this explicitly. It was implied by omission. Implied rules are where developers and testers make different assumptions, and the table forces the assumption into the open where someone can confirm it.
Collapsing columns that do not matter
Eight columns is manageable. Six conditions would give 64, and ten would give 1,024. So the next step is to merge columns where a condition makes no difference to the outcome. Look at rules 1 and 3: both are Gold and within 5 km, they differ only in order value, and both are free. Order value is irrelevant for that pair, so they merge into one rule with a dash (meaning “don’t care”) in the order-value row. Do the same for the others:
| Rule | A (1,3) | B (2,4) | C (5) | D (7) | E (6,8) |
|---|---|---|---|---|---|
| Gold member | Y | Y | N | N | N |
| Order ≥ ₹499 | – | – | Y | N | – |
| Distance ≤ 5 km | Y | N | Y | Y | N |
| Fee | Free | ₹30 | Free | ₹30 | ₹60 |
Five rules now cover all eight combinations. A useful sanity check: count how many original columns each collapsed rule represents (a dash doubles the count for a binary condition). Here 2 + 2 + 1 + 1 + 2 = 8, so nothing has been lost and nothing double-counted. If your total is less than the full set, a combination is missing; if it is more, two rules overlap and the specification may contradict itself.
Each remaining column becomes at least one test case. For rule E you might pick a non-Gold customer at 7 km with a ₹200 order. A careful tester sometimes runs both halves of a collapsed column anyway (one with a small order, one with a large one), because the dash describes what the specification says, not necessarily what the code does. If a developer wrote the free-delivery check before the distance check, rule 6 is the exact column that would expose it.
What the table catches that a list of test cases does not
Testers who write cases straight from a requirement tend to produce the “happy” combinations: a Gold member nearby, a regular customer with a small order nearby, someone far away. Those are rules A, D and maybe E. Rules B and C are easily skipped, and they are exactly where the logic branches.
The table also finds problems in the requirement itself, before any code exists. Three kinds turn up often:
- Gaps. A column with no action defined. If the policy had said nothing about Gold members beyond 5 km, rule B would have an empty fee cell, and that is a question for the product manager, not a guess for the developer.
- Contradictions. Two statements in the requirement that put different actions in the same column. “Gold members always get free delivery” plus “orders beyond 5 km always pay ₹60” collide in rule B.
- Impossible combinations. Some columns cannot occur in reality. If a condition were “user is logged in” and another “user is a Gold member”, the column for “not logged in, Gold member” might be impossible. Mark it as such rather than silently dropping it, so a reviewer can see you considered it.
Where decision tables meet boundaries
A decision table tells you which combinations to test. It does not tell you which exact values to use. “Order ≥ ₹499” is a condition with a boundary, and the bug might be that the code uses greater-than instead of greater-than-or-equal. So decision tables pair naturally with boundary value analysis: for rule C, pick an order of exactly ₹499 in one test and ₹498 in the matching rule D test. Distance has the same issue at 5.0 km, and also a less obvious one: is distance measured as a straight line or along the road, and is it rounded before comparison? A table cannot answer that, but writing it makes you ask.
When the technique stops scaling
Decision tables grow exponentially. With five binary conditions you have 32 raw columns; with eight, 256. Collapsing helps a lot when many conditions are irrelevant in many situations, which is common in real policies. When conditions are genuinely independent and all matter, though, the table gets unreadable. At that point, testers usually do one of three things:
- Split the rule into smaller tables. Eligibility (can this customer get a loan at all?) and pricing (what interest rate?) are often separate decisions, each with its own small table.
- Use pairwise testing to choose a reduced set of combinations, accepting that some three-way interactions will go untested.
- Move the logic into a rules engine or a configuration table, then test the engine once and validate the configuration data separately.
Conditions with more than two values also inflate the count. Membership might be Free, Silver or Gold rather than yes/no, which makes the raw table 3 × 2 × 2 = 12 columns. The method is identical; only the arithmetic changes.
Good places to use one
Any feature where the outcome depends on several inputs considered together is a candidate: insurance premium loading based on age band, smoker status and sum assured; GST treatment based on whether supplier and buyer are in the same state and whether the buyer is registered; access control where role, department and record status jointly decide what a user can edit; or a bank’s rule for waiving a minimum balance penalty. In each case, drawing the table is often faster than arguing about the requirement in a meeting, and the finished table doubles as documentation the developer can code against.
The real value is not the test cases themselves. It is that the table makes every combination someone’s explicit decision rather than an accident of how the code happened to be written.
Written by the RP Strativa Team. The delivery fee policy and figures in the example are illustrative.
Leave a Reply