You are on page 1of 15

# Decision Tables

## A useful testing technique and

more
Marien de Wilde, Solution Architect

In this session

Definition
Application areas
Steps to create a

decision table
Exercise
Solution to exercise

February 20

Definition
Causes
Cause 1
Cause 2
Cause 3
Effects
Effect 1
Effect 2

Combinations
Values 1 2 3 4 5 6 7 8
Y, N
Y Y Y Y NNNN
Y, N
Y Y NNY Y NN
Y, N
Y NY NY NY N
X

X
X

February 20

X
X

Components
A decision table lists

## causes and effects in a

matrix. Each column
represents a unique
combination.
Purpose is to structure
logic

Cause = condition
Effect = action = expected results

Application Areas
Programming
Testing
Hardware Design
etc

February 20

## Steps to Create a decision table

1. List all causes in the decision table
2. Calculate the number of possible
3.
4.
5.
6.
February 20

combinations
Fill columns with all possible
combinations
Reduce test combinations
Check covered combinations
Add effects to the table
5

## Step 1: List all causes

Causes
Cause 1
Cause 2
Cause 3
Effects
Effect 1
Effect 2

February 20

Values
Y, N
Y, N
Y, N

Hints:
Combinations
1 2 3 4 5 6
7 8Write down the values
Y Y Y Y NNNN
Y Y N N Y Y N Nthe cause/condition can
Y N Y N Y N Y Nassume
XCluster related causes
X
X
X
X
X
Put the most
dominating cause first
Put multi valued causes
last
6

## Step 2: Calculate combinations

Number of Values to If all causes are simply Y/N
the power of the
values:
number of causes
2number of causes
with these values

## If 1 cause with 3 values and 3

February 20

with 2:
31 * 23 = 24
Or, use the Values column
and multiply each value
down the column, eg.
3*2*2*2=24

## Step 3: Fill columns

Algorithm:
1. Determine Repeating Factor (RF):

## divide remaining combinations by the

number of possible values for that
cause
2. Write RF times the first value, then
RF times the next etc. until row is full
3. Next row, go to 1.
February 20

## Step 4: Reduce combinations

Causes
Cause 1
Cause 2
Cause 3
Effects
Effect 1
Effect 2
Causes
Cause 1
Cause 2
Cause 3
Effects
Effect 1
Effect 2

Combinations
Values 1 2 3 4 5 6 7 8
Y, N
Y Y Y Y NNNN
Y, N
Y Y NN Y Y NN
Y, N
Y N - - Y NY N
X

X
X

Combinations
Values 1 2 3 4 5 6 7
Y, N
Y Y Y NNNN
Y, N
Y Y NY Y NN
Y, N
Y N - Y NY N

February 20

combinations place
a -

X
X

Find indifferent

X
X

## columns are identical

Tip: ensure the effects are
the same

## Step 5: Check covered

combinations
Causes
Cause 1
Cause 2
Cause 3
Effects
Effect 1
Effect 2
Checksum

Checksum
For each column calculate the

Combinations
Values 1 2 3 4
Y, N
Y Y Y N
Y, N
Y N N Y, N
- Y N X
2

February 20

X
1

combinations it represents
A - represents as many
combinations as the cause has
Multiply for each - down the
column
Add up total and compare with
step 2
10

Causes
Cause 1
Cause 2
Cause 3
Effects
Effect 1
Effect 2
Checksum

Combinations
Values 1 2 3 4
Y, N
Y Y Y N
Y, N
Y N N Y, N
- Y N -

February 20

X
X
2

X
X
1

## column and determine

the effects
One effect can occur
in multiple test
8 combinations

11

Exercise: Specification
Create a decision table
A mailing is to be sent out to customers. The content
of the mailing is about the current level of
discounting and potential levels of discounting. The
content is different for different types of customers.
Customer Types A, B and C get a normal letter except
Customer Type C, who get a special letter. Any
customer with 2 or more current lines or with a
credit rating of X get a special paragraph added
with an offer to subscribe to another level of
discounting.
February 20

12

February 20

13

## Exercise: possible solution

Causes
Customer Type
2 or more lines
Credit rating = X
Effects
Normal Letter
Special Letter
No Letter
Checksum

Values
A,B,C,O
Y, N
Y, N

1
A
Y
Y

2
A
Y
N

3
A
N
Y

4
A
N
N

5
B
Y
Y

6
B
Y
N

Combinations
7 8 9 10 11 12
B B C C C C
N N Y Y N N
Y N Y N Y N

X X X X X X X X
? X X

? X X

X X X X
? X X

1 1 1 1 1 1 1 1 1 1

13
O
Y
Y

14
O
Y
N

15
O
N
Y

16
O
N
N

?
?
?
?
1

?
?
?
?
1

?
?
?
?
1

?
?
?
?
1

16

## 2 or more current lines OR credit rating X. What if both: AND?

Other customer types? See O-Other above.
What about non current lines?

February 20

14

Thank You

February 20

15