You are on page 1of 37

# So#ware

Tes+ng
Prepared by

Outline
Decision tables
Cause-eect graphs

Decision Tables
hCp://istqbexamcer+ca+on.com/what-is-decision-table-
in-so#ware-tes+ng/
Decision tables enable modeling complex business rules in
a systema+c way.
How does it work?
Iden+fy a suitable func+on or subsystem which reacts
according to a combina+on of inputs/events.
The system should not contain too many inputs (why?)
Combine all those inputs into a table to iden+fy their
true/false combina+ons, and the systems expected
corresponding behaviour.

Decision Tables
Consider a loan applica+on, where you can
enter the amount of the monthly repayment or
the number of years you want to take to pay it
back (the term of the loan).
If you enter both, the system will make a
compromise between the two if they conict.
What inputs do we have?
Amount of loan
Term of loan

## Decision Tables Exercise!

If you are a new customer and you want to open a
credit card account then You will get a 15% discount
If you are an exis+ng customer and you hold a loyalty
card, you get a 10% discount.
If you have a coupon, you can get 20% o today (but it
cant be used with the new customer discount).
Discount amounts are added, if applicable.
You have 5 minutes.

Black-Box Tes+ng
Cause-eect graphing

Cause-eect Graphing
Equivalence par++oning and boundary value
analysis do not explore combina+ons of input
circumstances.
Hence, you can go for cause-eect graphing

Cause-eect Graphing
What is a cause-eect graph?
A visual technique for modeling the rela+onship
between the inputs and outputs of a program
The inputs (causes) could be specied as
condi+ons, and the outputs (eects) in terms of
expected values or behaviour.

Cause-eect Graphing
What is a cause-eect graph?
A cause is any input condi+on in the requirements
that may aect the programs output.
A cause can represent an equivalence class of input
condi+ons.
An eect is an output condi+on, or a system
transforma+on.

Cause-eect Graphing
How are the tests derived?
1. The specica+on is divided into workable pieces.(why?)
E.g.: When tes+ng a web page design, you might test a

## 2. The causes/eects in the specica+on are iden+ed.

3. The seman+c content of the specica+on is analyzed
and transformed into a Boolean graph linking the
causes and eects (i.e., a cause-eect graph).
4. Annotate the graph with constraints on combina+ons
of causes and/or eects that are impossible (how?)
5. Convert the graph into a limited-entry decision table.
6. Convert the columns of the decision table into test
cases.

## Cause-eect Graph Symbols

Four dierent func+ons can be used:
1. The Iden+ty func+on: if a is 1, b is 1; else b is 0.

## Cause-eect Graph Symbols

Four dierent func+ons can be used:
2. The not func+on: if a is 1, b is 0; else b is 1.

## Cause-eect Graph Symbols

Four dierent func+ons can be used:
4. The and func+on: if both a and b are 1, c is 1; else c is 0.

## Cause-eect Graph Symbols

Example:
The character in column 1 must be an A or a B. The
character in column 2 must be a digit. In this situa+on,
If the rst character is incorrect, message X12 is issued.
If the second character is not a digit, message X13 is
issued.
Let us try to create a cause-eect graph
What causes do we have?
What eects do we have?

## Cause-eect Graph Symbols

What would its equivalent logic circuit look like?

## Cause-eect Graph Symbols

Equivalent logic circuit.

## Cause-eect Graph Symbols

ButA character cannot be an A and a B
simultaneously cause 1 and cause 2 cannot be 1
simultaneously.
Hence, some constraints need to be added.

## Cause-eect Graph Constraints

Four types of constraints can be added:
1. The Exclusive (E) constraint: It must always be true that
at most one of the causes can be 1.

2. The Inclusive (I) constraint: At least one of the causes
must be 1.

## Cause-eect Graph Constraints

Four types of constraints can be added:
1. The Exclusive (E) constraint: It must always be true that
at most one of the causes can be 1.
2. The Inclusive (I) constraint: At least one of the causes
must be 1.

## Cause-eect Graph Constraints

3. The One and Only One (O) constraint: One and only one
of the causes must be one.

4. The Requires (R) constraint implies that for C1 to be 1,
C2 must be 1 (i.e., it is impossible for C1 to be 1 and C2 to
be 0).

## Cause-eect Graph Constraints

3. The One and Only One (O) constraint: One and only
one of the causes must be one.
4. The Requires (R) constraint implies that for C1 to be 1,
C2 must be 1 (i.e., it is impossible for C1 to be 1 and C2 to
be 0).

## Cause-eect Graph Constraints

One more constraint exists among eects: The masking
constraint (M): If eect a is 1, eect be is forced to be
0.

## Cause-eect Graph Symbols

ButA character cannot be an A and a B
simultaneously cause 1 and cause 2 cannot be 1
simultaneously.
Hence, one constraint needs to be added.

## Cause-eect Graph Symbols

ButA character cannot be an A and a B
simultaneously cause 1 and cause 2 cannot be 1
simultaneously.
Hence, one constraint needs to be added.

Example

## A GUI based computer purchase system is oering

computers (CPU), printers (PR), monitors (M), and
addi+onal memory (RAM). An order congura+on
consists of one to four items as shown below:

The GUI consists of four windows for displaying
selec+ons from CPU, Printer, Monitor, and RAM and
one window where free giveaway items are displayed.
For an order, the buyer may select from three CPU
models, two printer models, and three monitors.
Let us draw the causes and the eects rst.

Example (Contd)

## 1. Purchase of CPU 1 gets RAM 256 upgrade

One eect for RAM 256
2. PR1 is available free with the purchase of CPU 2 or CPU 3.
Purchase of CPU 2 or CPU 3 gets a RAM 512 upgrade.
One eect groups RAM 512 and PR1
3. Monitors and printers, except for 30, can also be
purchased separately without purchasing any CPU.
One eect of no giveaway.
4. The RAM 1G upgrade and a free PR 2 is available when
CPU 3 is purchased with monitor 30.
One eect for the combined oer

Example (Contd)

## 5. 30 can only be purchased with CPU 3.

Requires constraint
6. Only one CPU can be purchased in one order
Exclusive constraint

Example (Contd)

Sample congura+ons and contents of the Free window
are given below.

Example (Contd)
What causes do we have?
C1 : Purchase CPU 1.
C2 : Purchase CPU 2.
C3 : Purchase CPU 3.
C4 : Purchase PR 1.
C5 : Purchase PR 2.
C6 : Purchase M 20.
C7 : Purchase M 23.
C8 : Purchase M 30.

Example (Contd)

What eects do we have?
The applica+on so#ware calculates and displays the list of
items available free with the purchase and the total price.
For simplicity, we ignore the price related cause and
eect.
The set of eects in terms of the contents of the Free
display window are listed below.

E : RAM 256.
E : RAM 512 and PR 1.
E : RAM 1G and PR 2.
E : No giveaway with this item.
1

Example (Contd)

## Conver+ng Cause-Eect Graphs

to Decision Tables
Each cause represents a row in the decision table
Each eect represents a row in the decision table
Each column in the resul+ng decision table represents a
combina+on of input values and hence a test.
How to generate the decision table?
Input: A cause-eect graph containing causes C-1 to C-P,
and eects Ef-1 to Ef-Q.

## Conver+ng Cause-Eect Graphs

to Decision Tables
For each eect Ef-i
Find the combina+ons of condi+ons that cause e to be
present.
Make sure that the combina+ons sa+sfy any
constraints among the causes.
Update the decision table with the retrieved
combina+ons
For each combina+on, determine the states of all
other eects and place these in each column.

## Decision Tables from Cause-Eect Graphs

Let us try to generate a limited-entry decision table for the
above cause-eect graph.

## Decision Tables from Cause-Eect Graphs

Let us try to generate a decision table