0% found this document useful (0 votes)
242 views

Decision Tables

A decision table is a graphical method to represent logical decisions using conditions and actions. It consists of conditions that are applied to input data and corresponding actions. The document provides examples of decision tables for a login screen and photo upload screen to illustrate how conditions and rules are represented. It also includes an example decision table for an insurance eligibility rule and a product discount rule.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
242 views

Decision Tables

A decision table is a graphical method to represent logical decisions using conditions and actions. It consists of conditions that are applied to input data and corresponding actions. The document provides examples of decision tables for a login screen and photo upload screen to illustrate how conditions and rules are represented. It also includes an example decision table for an insurance eligibility rule and a product discount rule.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

Decision Table

A decision table is a graphical method for explaining the logic of making decision in tabular format.

It is a set of conditions + set of actions and different combinations of decisions.

“It is a matrix representation of logic of decisions which specify the possible conditions for decision and
resulting actions.”

The decision table is divided into two parts:

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:-

It describes the conditions that exist in the program logic.

                                                     ii.            Condition Entry:-

It provides answers to questions asked in the condition asked in the condition term.

2.    Action:

The action part is subdivided into two parts à

                                                       i.            Action Stub:-

It describes the action to be taken to meet each condition.

                                                     ii.            Action Entry:-

It describes the appropriate action resulting from the answer to the condition in condition entry.

Format:
Table Heading Decision Rule

Condition Stub Condition Entry

Action Stub Action Entry

Advantages of Decision Table

1.    It provides compact representation of decision making process.

2.    It is easier to understand particular path.

3.    It can be changed according to situation.

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.

Disadvantages of Decision Table

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.

Let's create a decision table for a login screen.


The condition is simple if the user provides correct username and password the user will be redirected
to the homepage. If any of the input is wrong, an error message 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

Output (E/H) E E E H

Legend:
 T – Correct username/password

 F – Wrong username/password

 E – Error message is displayed

 H – Home screen is displayed

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

While converting this to test case, we can create 2 scenarios ,

 Enter correct username and correct password and click on login, and the expected result will be
the user should be navigated to homepage

And one from the below scenario

 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

As they essentially test the same rule.

Example 2: How to make Decision Table for Upload Screen

Now consider a dialogue box which will ask the user to upload photo with certain conditions like –

1. You can upload only '.jpg' format image

2. file size less than 32kb

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

Let's create the decision table for this case.

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 Less than Less than >= 32kb >= 32kb Less than Less than >= 32kb >= 32kb
32kb 32kb 32kb 32kb

resolution 137*177 Not 137*177 Not 137*177 Not 137*177 Not


137*177 137*177 137*177 137*177

Output Photo Error Error Error Error Error Error Error


uploaded message message message message message message message fo
resolution size size and for format format and for format format,
mismatch mismatch resolution mismatch resolution and size size, and
mismatch mismatch mismatch resolution
mismatch

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.

          The driver will be insured if:-

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.

4.    The driver is male over 30.

5.    The driver is married and under 30.

Condition Rule1 Rule2 Rule3 Rule4 Rule5 Else

Lives in city Y Y N - - -
population<5000

Male Y - N Y - -

Married Y Y Y - Y -

Age>30 - Y - Y N -

Action Rule1 Rule2 Rule3 Rule4 Rule5 Else

Insured Y Y Y Y Y

Uninsured Y
Q: Study following conditions and draw a decision table:-

1.    If product code=A

And customer type=1

And the order amount<=700

Then 5% discount allowed

2.    If product code=A

And customer type=2

And the order amount<=700

Then 7.5% discount allowed

3.    If product code=A

And customer type=1

And the order amount>=700

Then 7.5% discount allowed

4.    If product code=A

And customer type=2


Condition Rule1 Rule2 Rule3 Rule4 Rule5 Else
And the order
Product Y Y Y Y N - amount>700
code=A
Then 10% discount
Customer Y N Y N - - allowed
type=1
5.    A flat discount of
Order Y Y N N - - 5% on product
amount<=70 code=B regardless of
0 customer type and
the order amount
Action Rule1 Rule2 Rule3 Rule4 Rule5 Else

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.

Condition Rule1 Rule2 Else

A 50% Y Y -

B 20% N Y -

C 30% Y N -

Action Rule1 Rule2 Else

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.

3.    Reject loan application in all other cases.

Condition Rule1 Rule2 Else

Customer has Account Y Y -

No Out-standing loan  amount Y N -

Special Management Approval - Y -

Action Rule1 Rule2 Else

Loan Application Accept Y Y

Loan Application Reject

You might also like