A decision table is a
To create a decision table, all possible conditions and their corresponding actions are listed down. Each condition is assigned a true or false value to test all possible combinations and to decide which action to take. Some conditions may take multiple actions. After this, test cases are created based on the decision table.
Consider a login system that takes a user’s email and password and after verifying it, displays the home page. In case incorrect credentials are given, an error message is displayed.
The following conditions can be generated for the given problem:
Following are the possible actions to be taken:
The given conditions and actions are displayed in a tabular form below:
Conditions | T1 | T2 | T3 | T4 |
C1: Enter email | F | F | T | T |
C2: Enter password | F | T | F | T |
Actions | ||||
A1: Display error, incorrect email | x | x | ||
A2: Display error, incorrect password | x | |||
A3: Display homepage | x |
Following test cases are created according to the above table:
Often decision tables are very complex due to multiple conditions and actions. To reduce complexity, a decision table is represented in a contracted form. This technique can combine one or more test cases to enhance visual representation and make the table more readable.
Suppose an online retail store gives a 15% discount if a customer buys ten or more items. An additional 10% discount is given if the customer has a loyalty card. Every purchase gives five loyalty points, which can later be redeemed for rewards. A complimentary bowl is given if a customer purchases EV-054, has a loyalty card, and purchases more than ten items.
The following conditions can be generated from the given statement:
Following are the possible actions to be taken:
The following decision table consists of all possible combinations:
Condition | T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8 |
C1: Ten or more items purchased | F | F | F | F | T | T | T | T |
C2: Customer has loyalty card | F | F | T | T | F | F | T | T |
C3: Item number EV-054 purchased | F | T | F | T | F | T | F | T |
Action | ||||||||
Give 15% discount | x | x | x | x | ||||
Give 10% discount | x | x | ||||||
Give 5 loyalty points | x | x | x | x | x | x | x | x |
Give a free bowl | x |
A simplified version of the table above is given below. A hyphen -
indicates that the conditions’ state doesn’t matter.
Condition | T1 | T2 | T3 | T4 |
C1: Ten or more items purchased | F | T | T | T |
C2: Customer has loyalty card | - | F | T | T |
C3: Item number EV-054 purchased | - | - | F | T |
Action | ||||
Give 15% discount | x | x | x | |
Give 10% discount | x | x | ||
Give 5 loyalty points | x | x | x | x |
Give a free bowl | x |
Free Resources