Unit-2 (Dataflow Testing)
Unit-2 (Dataflow Testing)
• Transaction-flow testing
Contents
4. Handling cases – decisions, biosis, mitosis, transactional junction, absorption & conjugation
5. TFG is not structured - Reasons
Transaction-flow
Transaction-flow represents a system’s processing. Functional testing methods are applied for
testing T-F.
Transaction-flow Graph
TFG represents a behavioral (functional) model of the program (system) used for functional
testing by an independent system tester.
Transaction
• is created (birth) due to an external act & up on its completion (closure), it remains in the form
of historical records.
6. Request direction from user 12. Record transaction in log & cleanup (Closure)
CPU- Y N N
More User wants Done
D Accept Valid ?
Pages ? Review?
Confirm
Transmit Set up
Diagnostic C Review
to Terminal
Uses of Transaction-flow
Loops are less as compared to CFG. Loops are used for user input error processing
• No direct one-to-one correspondence between the “processes” and “decisions” of transaction-flow, and the
corresponding program component.
Input S A S B S C S S Output
E
S : Scheduler A, B, C, D, E : Processes
REF BORIS BEIZER 7
Implementation of Transaction-Flow U2
Process
Queues A Processor B Processor C Processor D Processor E Processor
Application Processes
A Transaction is created by filling in a Transaction Control Block (TCB) by user inputs and by placing that
token on input Q of Scheduler.
Scheduler examines and places it on appropriate process Q such as A. When A finishes with the Token, it places
the TCB back on the scheduler Q.
3. Scheduler contains no code / data. Processing modules contain code for routing.
• Scheduler invokes processes A to E as well as disk & tape read & writes.
Cyclic structure like in this example is common in process control & communication systems.
The criteria for implementation mechanism depends on performance and resource optimization.
Transaction-flow testing is a block box technique. (as we assumed nothing regarding computer,
communications, environment, O.S., transaction identity or structure or state.)
• TFG has tokens, & DFG has data objects with history of operations applied on them.
2. Decision nodes of TFG have exception exits to the central recovery process.
2.Biosis Parent
Parent
Daughter Tr.
Daughter Tr.
3.Mitosis Parent
Daughter Tr.
Mergers of transactions
Path 1
Continue
1. Junction
Path 2
Daughter Tr.
2. Absorption
Predator
Predator
3. Conjugation
Parent Daughter
Parent
NOTES:
• Simple TFG model is not enough to represent multi-processor systems & associated
coordination systems.
• Petrinet model uses operations for all the above. But Petrinets are applied to H/W,
N/W protocol testing – but not Software.
Simplified TFG model U2
16
Transaction-flow Structure
6. Approximation to Reality
• Attempt to Structure
17
Transaction - Flow Testing - Steps U2
• Represent Explicitly
1. Conducting Walkthroughs
• Traceability to Requirements
Transaction - Flow Testing - Steps
1. Inspections, Reviews & Walkthroughs …
• Use patches & break points, mistune, and break the rules,
Transaction - Flow Testing Techniques
4. Instrumentation
2. Need
• Trace
• A Running Log
Make Instrumentation as part of System Design
Transaction - Flow Testing Techniques
5. Test Data bases
2. Mistakes
2. Transaction Dispatcher
• Uses tables & Finite State Machines
26
Transaction - Flow Testing - Caution
Hidden Languages (flow control language)
• Possibility of bugs
Software Testing Methodology
• Synopsis
• Basics
• Intro to Data flow, data flow graphs
• Motivation & Assumption
• Data flow model
Anomaly
• Data Flow Testing (DFT) uses Control Flow Graph (CFG) to explore dataflow
anomalies.
Definition:
Example:
Pick enough paths to assure that every data item has been initialized prior to
its use, or that all objects have been used for something.
Data - Flow Testing - Basics
Motivation
• Abstract M I M D
• Language & compiler take care of parallel computations
Data - Flow Testing - Basics - Motivation
Program Control flow with Von Neumann’s paradigm
Given m, n, p, q, find e.
e = (m+n+p+q) * (m+n-p-q)
a = n+m
a := m + n b=p+q
b := p + q
c := a + b c=a+b
d := a - b
d=a-b
e := c * d
e=c*d
Assumptions
Convert to a CFG
Used - (u)
• In a calculation - (c)
Action
du : normal
kd : normal
kk : harmless, but probably a bug
ku : a bug
ud : normal. Redefinition.
uk : normal
uu : normal
Data - Flow Testing - Basics - Motivation
Program Flow using Data Flow Machines paradigm
BEGIN
PAR DO n m p q
READ m, n, n, p, q
END PAR
PAR DO a := m+n b := p+q
a := m+n
b := p+q
END PAR c := a+b d := a-b
PAR DO
c := a+b
d := a-b e := c * d
END PAR
PAR DO
e := c * d
END PAR
END The interrelations among the data items remain same.
Data - Flow Testing - Basics – Data Flow Anomalies
Actions on data objects
d- possibly anomalous
Data - Flow Testing - Basics
• K, D, U, A
• Processing Step
• k, d, u
Data - Flow Testing - Basics
Data Flow Anomaly State graph
• Object state
• Unforgiving Data flow state graph
Undefined
K
k, u
d
u
d, k Anomalous
U D A
u
d Defined
Used d, k, u
Data - Flow Testing - Basics
Data Flow Anomaly State graph
d DK
k
u d
k
U D d
u
d
DD
u
d
Data - Flow Testing - Basics
Data Flow State Graphs
• Dynamic analysis
Intermediate data values
Insufficiency of Static Analysis (for Data flow)
• Based on CFG
Procedure to Build:
2. Predicated nodes
3. Sequence of links
1. Join
2. Concatenate weights
3. The converse
REF BORIS BEIZER
Data - Flow Testing - Basics : Data Flow Model
Example: an – 1
Z = b + ---------
START a - 1
INPUT a, b, n
Z := 0
IF a = 1 THEN Z := 1
GOTO DONE1
r := 1 c := 1
POWER:
c := c * a
r := r + 1
IF r <= n THEN GO TO POWER
Z := (c – 1) / (a – 1)
DONE1:
Z := b + Z
END
Data - Flow Testing - Basics – Data Flow model
CFG for the Example
Read a,b,n
Z := 0
Z := 1 Z := b + Z
1 2 5 6
a = 1?
P1
Y
Z := (c-1)/(a-1)
P2
3 4 r<n?
r := 1 c:=1 r := r+1, c:= c*a
Y
Data - Flow Testing - Basics – Data Flow model
CFG annotated – Data Flow Model for Z
d or kd cd or ckd
d
1 2 5 6
a = 1?
P1
Y
d or kd
P2
3 4 r<n?
Y
Data - Flow Testing - Basics – Data Flow model
CFG annotated – Data Flow Model for c
1 2 5 6
a = 1?
P1
Y
c-
-d
P2
ckd or kd
3 4 r<n?
Y
Data - Flow Testing - Basics – Data Flow model
CFG annotated – Data Flow Model for r
1 2 5 6
a = 1?
P1
Y
p-
-d
P2
ckd or kd
3 4 r<n?
Y
Data - Flow Testing - Basics – Data Flow model
CFG annotated – Data Flow Model for b
d c
1 2 5 6
a = 1?
P1
Y
P2
3 4 r<n?
Y
Data - Flow Testing - Basics – Data Flow model
CFG annotated – Data Flow Model for n
1 2 5 6
a = 1?
P1
Y
p-
P2
3 4 r<n?
Y
Data - Flow Testing - Basics – Data Flow model
CFG annotated – Data Flow Model for a
1 2 5 6
a = 1?
P1
p
c-
P2
c
3 4 r<n?
Y
Data - Flow Testing - Basics – Data Flow model
Purpose:
• Strongest DFT
• Every du path for every variable for every definition to every use
• At least one definition clear path segment from every definition of every variable to eve
use of that definition be exercised under some test.
• At least one path segment from every definition to every use that can be reached from t
definition.
Data - Flow Testing – Data Flow Testing Strategies
•APU + c
• Stronger than P2
•ACU + p
• Weaker than P2
Data - Flow Testing – Data Flow Testing Strategies
• APU :
• Include definition-free path for every definition of every variable from the
definition to predicate use.
• ACU :
• Include for every definition of every variable include at least one definition-free
path from the definition to every computational use.
Data - Flow Testing – Data Flow Testing Strategies
Ordering the strategies
All Paths
All du Paths
All Defs AD
All c uses (ACU)
All P-uses APU
All Branches P2
All Stmts P1
Data - Flow Testing – Data Flow Testing Strategies
Testing, Maintenance & Debugging in the Data Flow context
Slicing:
• A static program slice is a part of a program defined wrt a variable ‘v’ and
a statement ‘s’; It is the set of all statements that could affect the value of
‘v’ at stmt ‘s’.
Stmt1 var v
stmt2
Stmt3 var v
Stmt4 var v
Stmt s var v
Data - Flow Testing – Data Flow Testing Strategies
Dicing:
• A program dice is a part of slice in which all stmts. which are known to be
correct have been removed.
Debugging:
• Select a slice.
• Narrow it to a dice.
Dynamic Slicing:
• Refinement of static slicing
Comparison of # test cases for ACU, APU, AU & ADUP by Shimeall &
Levenson
Test Cases Normalized. t = a + b * d (d = # binary decisions)
At most d+1 Test Cases for P2 loop-free
# Test Cases / Decision
ADUP ~ ½ APU*
AP ~ AC
Data - Flow Testing - – Data Flow Testing Strategies
Application of DFT
DFT vs P1, P2
• DFT is Effective
• Cost-effective development
• Commercial tools :
• Efficient Testing
Data - Flow Testing – Questions from the previous year’s exams
1. How is data flow testing (DFT) helpful in fulfilling gaps in path testing?
3. How can anomaly be detected? Explain different types of data flow anomalies and Data flow
Anomaly State Graphs.