Decision Tables
Decision Tables
A decision table is a graphical method for explaining the logic of making decision in tabular format.
“It is a matrix representation of logic of decisions which specify the possible conditions for decision and
resulting actions.”
1. Condition
2. Action
1. Condition:
The condition part specifies all conditions that are applied to the inputted data. It is also divided into two
parts à
i. Condition Stub:-
ii. Condition Entry:-
It provides answers to questions asked in the condition asked in the condition term.
2. Action:
i. Action Stub:-
ii. Action Entry:-
It describes the appropriate action resulting from the answer to the condition in condition entry.
Format:
Table Heading Decision Rule
4. These are best suited for calculating discounts, commissions or inventory control procedures.
5. The structure of decision table promotes a logically complete and consistent problem definition.
1. It cannot express the complete sequence of operations to solve a problem therefore it may be
difficult for the programmer to translate decision table into program.
2. If there are too many alternatives, it is difficult to list in decision table.
3. It does not show the flow of logic for the solution to a given problem.
Username (T/F) F T F T
Password (T/F) F F T T
Output (E/H) E E E H
Legend:
T – Correct username/password
F – Wrong username/password
Interpretation:
Case 1 – Username and password both were wrong. The user is shown an error message.
Case 2 – Username was correct, but the password was wrong. The user is shown an error
message.
Case 3 – Username was wrong, but the password was correct. The user is shown an error
message.
Case 4 – Username and password both were correct, and the user navigated to homepage
Enter correct username and correct password and click on login, and the expected result will be
the user should be navigated to homepage
Enter wrong username and wrong password and click on login, and the expected result will be
the user should get an error message
Enter correct username and wrong password and click on login, and the expected result will be
the user should get an error message
Enter wrong username and correct password and click on login, and the expected result will be
the user should get an error message
Now consider a dialogue box which will ask the user to upload photo with certain conditions like –
3. resolution 137*177.
If any of the conditions fails the system will throw corresponding error message stating the issue and if
all conditions are met photo will be updated successfully
Format .jpg .jpg .jpg .jpg Not .jpg Not .jpg Not .jpg Not .jpg
Size Less than Less than >= 32kb >= 32kb Less than Less than >= 32kb >= 32kb
32kb 32kb 32kb 32kb
For this condition, we can create 8 different test cases and ensure complete coverage based on the
above table.
1. Upload a photo with format '.jpg', size less than 32kb and resolution 137*177 and click on
upload. Expected result is Photo should upload successfully
2. Upload a photo with format '.jpg', size less than 32kb and resolution not 137*177 and click on
upload. Expected result is Error message resolution mismatch should be displayed
3. Upload a photo with format '.jpg', size more than 32kb and resolution 137*177 and click on
upload. Expected result is Error message size mismatch should be displayed
4. Upload a photo with format '.jpg', size more than equal to 32kb and resolution not 137*177 and
click on upload. Expected result is Error message size and resolution mismatch should be
displayed
5. Upload a photo with format other than '.jpg', size less than 32kb and resolution 137*177 and
click on upload. Expected result is Error message for format mismatch should be displayed
6. Upload a photo with format other than '.jpg', size less than 32kb and resolution not 137*177
and click on upload. Expected result is Error message format and resolution mismatch should be
displayed
7. Upload a photo with format other than '.jpg', size more than 32kb and resolution 137*177 and
click on upload. Expected result is Error message for format and size mismatch should be
displayed
8. Upload a photo with format other than '.jpg', size more than 32kb and resolution not 137*177
and click on upload. Expected result is Error message for format, size and resolution mismatch
should be displayed
Q: An insurance company uses the following rule to determine the eligibility of a driver for insurance.
1. The driver lives in the city with population less than 5000 and he is married man.
2. The driver lives in the city with population less than 5000 and he is married and age is over 30 years
old.
3. The driver lives in the city with population is 5000 or more and it is married female.
Lives in city Y Y N - - -
population<5000
Male Y - N Y - -
Married Y Y Y - Y -
Age>30 - Y - Y N -
Insured Y Y Y Y Y
Uninsured Y
Q: Study following conditions and draw a decision table:-
Discount 5% Y Y
Discount Y Y
7.5%
Discount 10% Y
No Discount Y
Q: Draw a decision table for a company with three person A,B,C whose share in the company are
50%,20%,30% sequentially. Any low arises in the company will be passed if it is supported by share
holders and whose share holding exceed 2/3 of the total shares.
A 50% Y Y -
B 20% N Y -
C 30% Y N -
Low Passed Y Y
Low Rejected N
Q: A Co-operating bank xyz granted loan under following conditions draw decision table and tree-
1. If a customer has a account with the bank and has no loan outstanding (no dues), loan will be
granted.
2. If a customer has an account is outstanding from previous loan, loan will be granted if special
management approval is obtained.