What are decision tables?
Overview
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.
Example
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:
- C1: User enters the email.
- C2: User enters the password.
Following are the possible actions to be taken:
- A1: It displays an error message that an incorrect email id is entered.
- A2: It displays an error message that an incorrect password is entered.
- A3: It displays the homepage.
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:
- Test case 1: Displays an error message when an incorrect email and password are entered.
- Test case 2: Displays an error message when an incorrect email is entered.
- Test case 3: Displays an error message when the email is correct, but the password is incorrect.
- Test case 4: Displays the homepage if both email and password are correct.
Simplify the decision tables
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.
Example
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:
- C1: The customer purchases ten or more items.
- C2: The customer has a loyalty card.
- C3: The customer purchases item number EV-054.
Following are the possible actions to be taken:
- A1: Gives a 15% discount.
- A2: Gives an additional 10% discount.
- A3: Gives loyalty points.
- A4: Gives a free bowl.
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