4.4 Decision Table Testing
Key Takeaways
- Decision tables model combinations of conditions and the actions that follow.
- Each column, or rule, is a coverage item for decision table coverage.
- The technique is valuable when business rules interact.
- Impossible or irrelevant combinations may be removed or marked as do not care.
- A test case is usually derived from each rule that remains in scope.
Core Idea
Decision table testing is a black-box technique for rules with multiple conditions. Instead of testing each condition in isolation, it tests combinations of condition values and the resulting actions.
A decision table has condition rows, action rows, and rule columns. Each column represents one combination of condition values and expected actions. A rule column is the usual coverage item.
Decision tables are especially useful for pricing, authorization, eligibility, claims handling, workflow routing, and validation where one condition changes the meaning of another.
Worked Example: Delivery Fee
Requirement: A store charges a delivery fee based on membership, order total, and whether the order contains oversized items.
Rules:
- Gold members get free delivery unless the order has oversized items.
- Non-Gold customers get free delivery when the order total is at least $75 and there are no oversized items.
- Oversized items always require a $20 delivery fee.
- Otherwise, standard delivery is $8.
Conditions:
- C1: Customer is Gold member?
- C2: Order total is at least $75?
- C3: Has oversized item?
Actions:
- A1: Free delivery
- A2: Standard $8 delivery
- A3: Oversized $20 delivery
| Rule | R1 | R2 | R3 | R4 | R5 | R6 | R7 | R8 |
|---|---|---|---|---|---|---|---|---|
| Gold member? | Y | Y | Y | Y | N | N | N | N |
| Total at least $75? | Y | Y | N | N | Y | Y | N | N |
| Oversized item? | Y | N | Y | N | Y | N | Y | N |
| Free delivery | N | Y | N | Y | N | Y | N | N |
| Standard $8 | N | N | N | N | N | N | N | Y |
| Oversized $20 | Y | N | Y | N | Y | N | Y | N |
Each rule can become one test. For example, R6 is a non-Gold customer, total $80, no oversized item, expected free delivery. R8 is a non-Gold customer, total $30, no oversized item, expected $8 delivery.
This table also reveals that oversized items dominate the other conditions. R1, R3, R5, and R7 all result in the oversized fee. A team may decide to collapse those columns using a do-not-care marker for membership and total when oversized is true.
Collapsed Table
A collapsed table removes combinations that do not change the action. The same logic could be represented with fewer rules:
| Rule | C1 | C2 | C3 | C4 |
|---|---|---|---|---|
| Oversized item? | Y | N | N | N |
| Gold member? | - | Y | N | N |
| Total at least $75? | - | - | Y | N |
| Free delivery | N | Y | Y | N |
| Standard $8 | N | N | N | Y |
| Oversized $20 | Y | N | N | N |
The dash means do not care. If oversized is true, membership and total do not matter. If there is no oversized item and the customer is Gold, the order total does not matter.
Collapsed tables reduce test count, but only when the collapse preserves the intended logic. In regulated or high-risk areas, teams may keep a full table to make every combination explicit.
Coverage Measurement
Decision table coverage is usually rule coverage:
covered rules / total rules * 100
If the collapsed table has 4 rules and tests cover C1, C2, and C4, rule coverage is 3 / 4 = 75 percent. If the full table has 8 rules and tests cover 6, coverage is 75 percent there too, but the coverage basis is different. Always state which table is being used.
Exam Strategy
When a question gives conditions and actions, build the table before answering. Count combinations carefully. For binary conditions, the full table has 2 raised to the number of conditions. Three binary conditions create 8 possible rules.
Then remove impossible combinations only if the question says they are impossible or irrelevant. Do not invent business rules. The CTFL exam often tests whether you can derive a missing expected action or identify the test case that covers a particular rule.
A decision table has three binary conditions and no impossible combinations. How many full rule columns are possible?
Which situations are good candidates for decision table testing?
Select all that apply