10.2. Decision Table based Testing

In Requirementsbased Test Design, we use Decision Tables as intermediate step before writing test cases to test functionality of the system under test. Here using Decision tables, we represent all possible conditions. When we execute possible conditions we expect a specific action to be taken by the system. In case of a failure to exhibit expected action, it is quite indicative that a logic is missing. Thus, using Decision Tables we can easily track a set of conditions and corresponding to which actions.

In Decision Table based Testing, steps we follow include:

Develop Decision Table

Design Test Cases

Following sections discuss on these steps.

10.2.1. About Decision Table
Decision tables are useful to model complicated logic. They are precise and compact representations and are very useful in modeling statements like ifthenelse and switchcase statements. They associate conditions with actions to perform. But, unlike the control structures found in traditional programming languages, decision tables can associate many independent conditions with several actions in an elegant way.

A decision table is a table composed of rows and columns, separated into four separate quadrants.

Conditions

Condition Alternatives

Actions

Action Entries


The upper left quadrant contains the conditions. The upper right quadrant contains the condition rules or alternatives. The lower left quadrant contains the actions to be taken and the lower right quadrant contains the action rules.

10.2.2. Developing Decision Tables
In order to build decision tables, first we need to determine the maximum size of the table, then we have to eliminate any impossible situations, inconsistencies, or redundancies, and finally we need to simplify the table as much as possible. Following are tips to develop decision tables, which when followed give a decision table.


Study the given Specification and determine the number of conditions that may affect the decision. Remove any conditions that repeat. Once we arrive at this list of nonrepeatable conditions (that is conditions that are mutually exclusive), we have to record all these conditions as rows in the top left half of the decision table.

Determine the number of possible actions that can be taken. This becomes the number of rows in the lower left half of the decision table.

Determine the number of condition alternatives for each condition. In the simplest form of decision table, there would be two alternatives (Y or N) for each condition. In an extendedentry table, there may be many alternatives for each condition

Then we have to calculate the maximum number of columns in the decision table by calculating number of conditions raise to the number of alternatives. If there were three conditions and two alternatives (Y or N) for each of the conditions, there would be eight alternatives. This is because, the condition rules are yes or no, therefore the number of possible condition rules are 2 alternatives for condition 1 x 2 alternatives for condition 2 x 2 alternatives for condition
3 or 2^{3} = 8.

Fill in the condition alternatives. Start with the first condition and divide the number of columns by the number of alternatives for that condition. In the foregoing example, there are three columns and two alternatives (Y and N), so eight divided by two is four. Then choose one of the alternatives and write Y in all of the four columns. Finish by writing N in the remaining four columns as follows:
Condition1: YYYYNNNN
Repeat this for each condition using a subset of the table:
Y

Y

Y

Y

N

N

N

N

Y

Y

N

N





y

N







and continue the pattern for each condition
Y

Y

Y

Y

N

N

N

N

Y

Y

N

N

Y

Y

N

N

y

N

Y

N

Y

N

Y

N


Complete the table by inserting a √ where rules suggest certain actions

Combine rules where it is apparent that an alternative does not make a difference in the outcome;
for example:
Condition 1

YY

Condition 2

YN

Condition 3

YY

Action 1

√ √

can be expressed as
Condition 1

Y 
Condition 2

Y/N

Condition 3

Y 
Action 1

√ √


Check the table for any impossible situations, contradictions, redundancies.

Rearrange the conditions and actions (or even rules) to make the decision table more understandable.

10.2.3. An Example on Creating Decision Table
Write test cases for fixed deposit interest calculations with following conditions.


Deposite
Amount

090 Days

90 Days
1 Years

1 Years
3 Years

3 years 
5 years

Above
5 years

a

<= 5000

5%

5.5%

6%

6.5%

7%

b

5001 to
50000

5.5%

6%

6.5%

7%

7.5%

c

50001 to
100000

6.5%

7%

7.5%

8%

8.5%

d

100001 to
500000

7.5%

8% 
8.5%

9%

9.5%


The branch cannot accept more than 5,00,000 deposit in single name.
The minimum balance is Rs 1000/

For this problem, the conditions to check are agreed involve, three variable, viz., Deposit Amount, Duration, Rate of Interest. So we have to develop many Decision Tables.

In the first step, we have convert three dimensional problem (since three variables are involved) into two dimensional problem so as to represent in Decision Table form.

10.2.4. An Example on Creating Decision Table
Problem specification for which we want to arrive at Decision Table which is an intermediate step before writing test cases for fixed deposit interest calculations involve following rules.


Deposite
Amount

090 Days

90 Days
1 Years

1 Years
3 Years

3 years 
5 years

Above
5 years

a

<= 5000

5%

5.5%

6%

6.5%

7%

b

5001 to
50000

5.5%

6%

6.5%

7%

7.5%

c

50001 to
100000

6.5%

7%

7.5%

8%

8.5%

d

100001 to
500000

7.5%

8% 
8.5%

9%

9.5%

e. The branch can not accept more than 500000 deposite in single name

f. The minimum balance is Rs. 1000/


For this problem, the conditions to check are agreed involve, three variable, viz., Deposit Amount, Duration, Rate of Interest. So we have to develop many Decision Tables.

In the first step, we have convert three dimensional problem (since three variables are involved) into two dimensional problem so that we can represent it in Decision Table form. In order to do this, we analyze the problem and understand that Deposit Amount is having 4 combinations; Duration is having 5 combinations; and Rate of Interest is having 5 combinations. Thus we take each Deposit Amount and develop Decision Table as follows:

First we take, for Deposit Amount between 1000 to <=5000.
Here the conditions are as follows:
Duration of Deposit is 0 to <=90 days
Duration of Deposit is 90 days to <=1 year
Duration of Deposit is 1 year to <=5 years
Duration of Deposit is Above 5 years
The possible actions that could be taken are agreed as:

Calculate Interest at 5%

Calculate Interest at 5.5%

Calculate Interest at 6%

Calculate Interest at 7%

Using the rules above construct a decision table showing all possible combinations of alternatives.

The condition rules are yes or no, therefore the number of possible condition rules are 2 alternatives for condition 1 x 2 alternatives for condition 2 x 2 alternatives for condition 3 x 2 alternatives for condition 4 or 2^{4} = 16


