Introduction
When software has many rules and conditions, it can be hard to test all possible combinations. Decision table testing helps organize these rules clearly so testers can check every important case without missing anything.
Imagine a restaurant menu where each dish depends on choices like type of meat, side dish, and sauce. A decision table is like a chart showing every possible combination of these choices and what the final dish looks like.
┌───────────────┬───────┬───────┬───────┐ │ Conditions │ Rule1 │ Rule2 │ Rule3 │ ├───────────────┼───────┼───────┼───────┤ │ Condition A │ T │ T │ F │ │ Condition B │ T │ F │ T │ ├───────────────┼───────┼───────┼───────┤ │ Actions │ Act1 │ Act2 │ Act3 │ └───────────────┴───────┴───────┴───────┘
def decision_table_test(condition_a, condition_b): if condition_a and condition_b: return 'Action 1' elif condition_a and not condition_b: return 'Action 2' elif not condition_a and condition_b: return 'Action 3' else: return 'No Action' # Test all rules print(decision_table_test(True, True)) # Action 1 print(decision_table_test(True, False)) # Action 2 print(decision_table_test(False, True)) # Action 3 print(decision_table_test(False, False)) # No Action