Guidelines for Testing Techniques and Test Measurement
B.4 Cause Effect Graphing
Introduction
This black box technique is based upon
an analysis of the specification of the component to model its behaviour by
means of causes and effects. We
illustrate the technique by means of a worked example. Naturally, the technique is only effective
to the extent that the model captures the specification of the component.
Example
Take a cheque
debit function whose inputs are debit
amount, account type and current balance and whose outputs are new balance and action
code. Account type may be
postal ('p') or counter ('c'). The action code may be 'D&L', 'D',
'S&L' or 'L', corresponding to 'process debit and send out letter',
'process debit only', 'suspend account and send out letter' and 'send out
letter only' respectively. The function
has the following specification:
If there are sufficient funds available in the account or
the new balance would be within the authorised overdraft limit then the debit
is processed. If the new balance would
exceed the authorised overdraft limit then the debit is not processed and if it
is a postal account it is suspended.
Letters are sent out for all transactions on postal accounts and for
non-postal accounts if there are insufficient funds available (i.e. the account
would no longer be in credit).
The conditions are:
C1 New
balance in credit
C2 New
balance overdraft, but within authorised limit
C3 Account
is postal
The actions are:
A1 Process debit
A2 Suspend account
A3 Send out letter
A cause-effect
graph shows the relationship between the conditions and actions in a notation
similar to that used by designers of hardware logic circuits. The specification is modelled by the graph
shown in Figure B.4.

Figure B.4: Cause-effect graph
The code graph is then recast in terms
of a decision table. Each column of the
decision table is a rule. The table
comprises two parts. In the first part
each rule is tabulated against the conditions.
A 'T' indicates that the condition must be TRUE for the rule to apply
and an 'F' indicates that the condition must be FALSE for the rule to apply. In the second part, each rule is tabulated
against the actions. A 'T' indicates
that the action will be performed; an 'F' indicates that the action will not be
performed; an asterisk (*) indicates that the combination of conditions is
infeasible and so no actions are defined for the rule.
The
example has the following decision table:
|
Rules:
|
1
|
2
|
3
|
4
|
5
|
6
|
7
|
8
|
|
C1: New balance in credit
|
F
|
F
|
F
|
F
|
T
|
T
|
T
|
T
|
|
C2: New balance overdraft,
but within
authorised limit
|
F
|
F
|
T
|
T
|
F
|
F
|
T
|
T
|
|
C3: Account is postal
|
F
|
T
|
F
|
T
|
F
|
T
|
F
|
T
|
|
A1: Process debit
|
F
|
F
|
T
|
T
|
T
|
T
|
*
|
*
|
|
A2: Suspend account
|
F
|
T
|
F
|
F
|
F
|
F
|
*
|
*
|
|
A3:
Send out letter
|
T
|
T
|
T
|
T
|
F
|
T
|
*
|
*
|
The
following test cases would be required to provide 100% cause-effect coverage,
and correspond to the rules in the decision table above (no test cases are
generated for rules 7 and 8 as they are infeasible):
|
|
CAUSES
|
EFFECTS
|
|
test
case
|
account
type
|
overdraft
limit
|
current
balance
|
debit
amount
|
new
balance
|
action
code
|
|
1
|
'c'
|
£100
|
-£70
|
£50
|
-£70
|
'L'
|
|
2
|
'p'
|
£1500
|
£420
|
£2000
|
£420
|
'S&L'
|
|
3
|
'c'
|
£250
|
£650
|
£800
|
-£150
|
'D&L'
|
|
4
|
'p'
|
£750
|
-£500
|
£200
|
-£700
|
'D&L'
|
|
5
|
'c'
|
£1000
|
£2100
|
£1200
|
£900
|
'D'
|
|
6
|
'p'
|
£500
|
£250
|
£150
|
£100
|
'D&L'
|