A decision table is used to represent the logic of making decisions in a tabular format. It contains conditions and actions. The document provides examples of creating decision tables for a login screen and photo upload screen. These tables contain conditions that must be met and the resulting actions. They can be used to systematically test all possible combinations of conditions.
Electrostatic field in a coaxial transmission line
Decision tables
1. DecisionTable
A decisiontable isagraphical methodforexplainingthe logicof makingdecisionintabularformat.
It isa setof conditions+setof actionsand differentcombinationsof decisions.
“It isa matrix representationof logicof decisions whichspecifythe possible conditionsfordecisionand
resultingactions.”
The decisiontable isdividedintotwoparts:
1. Condition
2. Action
1. Condition:
The conditionpartspecifiesall conditionsthatare appliedtothe inputteddata.Itis alsodividedinto
twoparts à
i. ConditionStub:-
It describesthe conditionsthatexistinthe programlogic.
ii. Condition Entry:-
It providesanswerstoquestionsaskedinthe conditionaskedinthe conditionterm.
2. Action:
The action part issubdividedintotwoparts à
i. ActionStub:-
It describesthe actiontobe takento meeteachcondition.
ii. ActionEntry:-
It describesthe appropriate actionresultingfromthe answertothe conditioninconditionentry.
Format:
2. Table Heading DecisionRule
ConditionStub ConditionEntry
ActionStub ActionEntry
Advantages of DecisionTable
1. It providescompactrepresentationof decisionmakingprocess.
2. It is easiertounderstandparticularpath.
3. It can be changedaccordingto situation.
4. These are bestsuitedforcalculatingdiscounts,commissionsorinventorycontrol procedures.
5. The structure of decisiontable promotesalogicallycomplete andconsistentproblemdefinition.
Disadvantages of DecisionTable
1. It cannot expressthe completesequence of operationstosolve aproblemtherefore itmaybe
difficultforthe programmertotranslate decisiontable intoprogram.
2. If there are too manyalternatives,itisdifficulttolistindecisiontable.
3. It doesnot showthe flowof logicfor the solutiontoa givenproblem.
Let's create a decision table for a login screen.
The conditionissimple if the userprovidescorrectusername andpasswordthe userwill be redirected
to the homepage.If anyof the inputiswrong,an errormessage will be displayed.
Conditions Rule 1 Rule 2 Rule 3 Rule 4
Username (T/F) F T F T
Password (T/F) F F T T
3. Output (E/H) E E E H
Legend:
T – Correct username/password
F – Wrong username/password
E – Error message isdisplayed
H – Home screenisdisplayed
Interpretation:
Case 1 – Username andpasswordbothwere wrong.The useris shownanerror message.
Case 2 – Username wascorrect,but the passwordwaswrong.The useris shownanerror
message.
Case 3 – Username waswrong,but the passwordwascorrect.The useris shownanerror
message.
Case 4 – Username andpasswordbothwere correct,and the usernavigatedtohomepage
While convertingthistotestcase,we can create 2 scenarios,
Enter correctusername andcorrect password andclick onlogin,andthe expectedresultwill be
the usershouldbe navigatedtohomepage
Andone from the belowscenario
Enter wrongusername andwrongpasswordandclickon login,andthe expectedresultwill be
the usershouldgetan error message
Enter correctusername andwrongpasswordand clickon login,andthe expectedresultwillbe
the usershouldgetan error message
Enter wrongusername andcorrectpasswordand clickon login,andthe expectedresultwillbe
the usershouldgetan error message
As theyessentiallytestthe same rule.
Example 2: How to make DecisionTable for Upload Screen
Nowconsidera dialogue box whichwill askthe usertouploadphotowithcertainconditionslike –
1. You can uploadonly'.jpg'formatimage
4. 2. file size lessthan32kb
3. resolution137*177.
If any of the conditionsfailsthe systemwillthrow correspondingerrormessage statingthe issue andif
all conditionsare metphotowill be updatedsuccessfully
Let's create the decisiontable forthiscase.
Conditions Case 1 Case 2 Case 3 Case 4 Case 5 Case 6 Case 7 Case 8
Format .jpg .jpg .jpg .jpg Not.jpg Not.jpg Not.jpg Not.jpg
Size Lessthan
32kb
Lessthan
32kb
>= 32kb >= 32kb Lessthan
32kb
Lessthan
32kb
>= 32kb >= 32kb
resolution 137*177 Not
137*177
137*177 Not
137*177
137*177 Not
137*177
137*177 Not
137*177
Output Photo
uploaded
Error
message
resolution
mismatch
Error
message
size
mismatch
Error
message
size and
resolution
mismatch
Error
message
for format
mismatch
Error
message
formatand
resolution
mismatch
Error
message
for format
and size
mismatch
Error
message
for format,
size,and
resolution
mismatch
For thiscondition,we cancreate 8 differenttestcasesandensure completecoverage basedonthe
above table.
1. Uploada photowithformat'.jpg', size lessthan32kb and resolution137*177 and clickon
upload.ExpectedresultisPhotoshoulduploadsuccessfully
2. Uploada photowithformat'.jpg',size lessthan32kb and resolutionnot137*177 and clickon
upload.ExpectedresultisError message resolutionmismatchshouldbe displayed
3. Uploada photowithformat'.jpg',size more than 32kb and resolution137*177 and clickon
upload.ExpectedresultisError message size mismatchshouldbe displayed
5. 4. Uploada photowithformat'.jpg',size more than equal to32kb andresolutionnot137*177 and
clickon upload.ExpectedresultisError message size andresolutionmismatchshouldbe
displayed
5. Uploada photowithformatotherthan '.jpg',size lessthan32kb and resolution137*177 and
clickon upload.ExpectedresultisError message forformatmismatchshouldbe displayed
6. Uploada photowithformatotherthan '.jpg',size lessthan32kb and resolutionnot137*177
and clickon upload.ExpectedresultisErrormessage formatand resolutionmismatchshould be
displayed
7. Uploada photowithformatotherthan '.jpg',size more than32kb and resolution137*177 and
clickon upload.ExpectedresultisError message forformatandsize mismatchshouldbe
displayed
8. Uploada photowithformatotherthan '.jpg',size more than32kb and resolutionnot137*177
and clickon upload.ExpectedresultisErrormessage forformat,size andresolutionmismatch
shouldbe displayed
Q: An insurance companyusesthe followingrule todeterminethe eligibilityof adriverforinsurance.
The driverwill be insuredif:-
1. The driverlivesinthe citywithpopulationlessthan5000 andhe ismarriedman.
2. The driverlivesinthe citywithpopulationlessthan5000 andhe ismarriedand age is over30 years
old.
3. The driverlivesinthe citywithpopulationis5000 or more and it ismarriedfemale.
4. The driverismale over30.
5. The driverismarriedandunder30.
Condition Rule1 Rule2 Rule3 Rule4 Rule5 Else
Livesincity
population<5000
Y Y N - - -
Male Y - N Y - -
Married Y Y Y - Y -
6. Q: Studyfollowingconditionsanddrawa decisiontable:-
1. If productcode=A
Andcustomertype=1
Andthe order amount<=700
Then5% discountallowed
2. If productcode=A
Andcustomertype=2
Andthe order amount<=700
Then7.5% discountallowed
3. If productcode=A
Andcustomertype=1
Andthe order amount>=700
Then7.5% discountallowed
4. If productcode=A
Andcustomertype=2
Age>30 - Y - Y N -
Action Rule1 Rule2 Rule3 Rule4 Rule5 Else
Insured Y Y Y Y Y
Uninsured Y
7. Andthe order amount>700
Then10% discountallowed
5. A flatdiscountof 5% onproduct code=Bregardlessof customertype andthe orderamount
Q: Draw a decision
table fora company
withthree person
A,B,Cwhose share inthe companyare 50%,20%,30% sequentially.Anylow arisesinthe companywill be
passedif itis supportedbyshare holdersandwhose share holdingexceed2/3of the total shares.
Condition Rule1 Rule2 Else
A 50% Y Y -
B 20% N Y -
C 30% Y N -
Action Rule1 Rule2 Else
Low Passed Y Y
Condition Rule1 Rule2 Rule3 Rule4 Rule5 Else
Product
code=A
Y Y Y Y N -
Customer
type=1
Y N Y N - -
Order
amount<=700
Y Y N N - -
Action Rule1 Rule2 Rule3 Rule4 Rule5 Else
Discount5% Y Y
Discount
7.5%
Y Y
Discount10% Y
No Discount Y
8. Low Rejected N
Q: A Co-operatingbankxyzgrantedloanunderfollowingconditionsdraw decisiontableandtree-
1. If a customerhas a account withthe bankand has no loanoutstanding(nodues),loanwill be
granted.
2. If a customerhas an account isoutstandingfrompreviousloan,loanwill be grantedif special
managementapproval isobtained.
3. Rejectloanapplicationinall othercases.
Condition Rule1 Rule2 Else
CustomerhasAccount Y Y -
No Out-standingloan amount Y N -
Special ManagementApproval - Y -
Action Rule1 Rule2 Else
Loan ApplicationAccept Y Y
Loan ApplicationReject