0% found this document useful (0 votes)
25 views79 pages

Unit-2 (Dataflow Testing)

This document covers Transaction-Flow Testing, detailing concepts such as transaction flows, transaction-flow graphs, and their implementation in systems. It outlines various testing techniques, including path selection, sensitization, and the importance of designing test databases. Additionally, it discusses the structure of transaction flows, reasons for their unstructured nature, and the significance of testing in complex systems like airline reservations and air traffic control.

Uploaded by

bhaskark.sb
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views79 pages

Unit-2 (Dataflow Testing)

This document covers Transaction-Flow Testing, detailing concepts such as transaction flows, transaction-flow graphs, and their implementation in systems. It outlines various testing techniques, including path selection, sensitization, and the importance of designing test databases. Additionally, it discusses the structure of transaction flows, reasons for their unstructured nature, and the significance of testing in complex systems like airline reservations and air traffic control.

Uploaded by

bhaskark.sb
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 79

Transaction-Flow Testing U2

We will see in this part of Unit 2:

• Concepts of Transaction flows

• Transaction-flow testing

REF BORIS BEIZER 1


Transaction-Flow Testing U2

Contents

1. Definitions of Transaction, Transaction flow, Transaction flow graph


2. It’s representation, implementation architecture in an O.S. & implementation in a system
3. A perspective of TFG model. View wrt DFG, CFG

4. Handling cases – decisions, biosis, mitosis, transactional junction, absorption & conjugation
5. TFG is not structured - Reasons

Transaction Flow Testing Techniques


1. Building transaction flows
2. Inspections, Reviews, and walkthroughs
3. Path selection
4. Path sensitization
5. Instrumentation
6. Test data bases
7. Test Execution
8. Transaction-flow implementation & testing related comments
1. Translation based systems
2. Hidden languages
Definitions of Transaction, Transaction-flow, TFG U2

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 a unit of work seen from system’s user point of view.

• consists of a sequence of operations performed by a system, persons or external devices.

• is created (birth) due to an external act & up on its completion (closure), it remains in the form
of historical records.

REF BORIS BEIZER 3


A Simple Transaction U2

Example: the sequence of steps in a transaction in an online information retrieval system

1. accept inputs 7. Accept Inputs

2. Validate inputs (Birth of tr.) 8. Validate inputs

3. Transmit ack. to the user 9. Process the request

4. Process input 10. Update file

5. Search file 11. Transmit output

6. Request direction from user 12. Record transaction in log & cleanup (Closure)

Users View of a transaction : Single step

Systems view : Sequence of many operations

REF BORIS BEIZER 4


Example of a Transaction flow (diagram) U2
User (terminal) Terminal controller CPU
cancel

User Request order Request Accept


Process
Begin Type order Order from B
Form
from CPU CPU
help

Transmit Accept More


B C Transmit D
Page to Input Fields? To CPU
terminal Field

CPU- Y N N
More User wants Done
D Accept Valid ?
Pages ? Review?
Confirm
Transmit Set up
Diagnostic C Review
to Terminal

REF BORIS BEIZER 5


U2

Transaction-flow Graph : a scenario between users & computer

Transaction-flow : an internal sequence of events in processing a transaction

Uses of Transaction-flow

Specifying requirements of big, online and complicated systems.

Airline reservation systems, air-traffic control systems.

Loops are less as compared to CFG. Loops are used for user input error processing

REF BORIS BEIZER 6


Implementation of Transaction-Flow (in a system) U2

• Implicit in the design of system’s control structure & associated database.

• No direct one-to-one correspondence between the “processes” and “decisions” of transaction-flow, and the
corresponding program component.

• A transaction-flow is a path taken by the transaction through a succession of processing modules.

• A transaction is represented by a token.

• A transaction-flow graph is a pictorial representation of what happens to the tokens.

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

System Control Structure (architecture of the implementation) :


Output
Input
Queue
Front
Queue EXECUTIVE Output
End SCHEDULER - AND / OR OPERATING SYSTEM Module
DISPATCHER

Process
Queues A Processor B Processor C Processor D Processor E Processor

Application Processes

Executive / Dispatcher Flowchart (a sample sequence)

Disc Tape Disc


1 Do All B’s Do All C’s Do All B’s 2
Reads Writes Writes

Disc Tape Disc


2 Do All D’s Do All A’s Do All E’s 1
Reads Reads Writes

REF BORIS BEIZER 8


Implementation of Transaction-Flow U2

System control structure


System is controlled by a scheduler …

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.

Scheduler routes it to the next process after examining the token :

1. It contains tables or code to route a token to the next process.

2. It may contain routing information only in tables.

3. Scheduler contains no code / data. Processing modules contain code for routing.

REF BORIS BEIZER 9


Implementation of Transaction-Flow U2

Transaction Processing System (simplified):


• There are many Tr. & Tr-flows in the system.

• Scheduler invokes processes A to E as well as disk & tape read & writes.

• The order of execution depends on priority & other reasons.

Cyclic structure like in this example is common in process control & communication systems.

 The criteria for implementation mechanism depends on performance and resource optimization.

REF BORIS BEIZER 10


A perspective of Transaction-Flow U2

Transaction-flow testing is a block box technique. (as we assumed nothing regarding computer,
communications, environment, O.S., transaction identity or structure or state.)

1. TFG is a kind of DFG.

• TFG has tokens, & DFG has data objects with history of operations applied on them.

• Many techniques of CFG apply to TFG & DFG

2. Decision nodes of TFG have exception exits to the central recovery process.

3. So, we ignore the effect of interrupts in a Transaction-flow.

REF BORIS BEIZER 11


Transaction Flows – splitting & merging decisions U2-B

Splits of transactions (Births)


Alternative 2
1.A decision point in TFG
Alternative 1

2.Biosis Parent
Parent

Daughter Tr.

Daughter Tr.
3.Mitosis Parent

Daughter Tr.

REF BORIS BEIZER 12


Transaction Flows – splitting & merging decisions U2

Mergers of transactions
Path 1
Continue
1. Junction
Path 2

Daughter Tr.
2. Absorption
Predator

Predator

3. Conjugation
Parent Daughter
Parent

REF BORIS BEIZER 13


TFG – splitting, merging Transactions U2

NOTES:

• Multiple meanings now for decision and junction symbols in a TFG.

• 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

Simplify TFG model

• Add New Tr-Flows for Biosis, Mitosis, Absorption, Conjugation

• Problems for programmer, designer & test designer.

• Need to design specific tests – possibility of bugs.

REF BORIS BEIZER 15


Transaction-flow Structure

Reasons for Unstructuredness

1. Processes involve Human Users

2. Part of Flow from External Systems

3. Errors, Failures, Malfunctions & Recovery Actions

4. Transaction Count, Complexity. Customer & Environment

16
Transaction-flow Structure

Reasons for Unstructuredness …

5. New Transactions, & Modifications

6. Approximation to Reality

• Attempt to Structure

17
Transaction - Flow Testing - Steps U2

First, Build / Obtain Transaction Flows

• Represent Explicitly

• Design details the Main Tr-Flows

• Create From PDL

• HIPO charts & Petrinet Representations

Objective – Trace the transaction


Transaction - Flow Testing - Steps

1. Inspections, Reviews & Walkthroughs

Start From Preliminary Design

1. Conducting Walkthroughs

• Discuss enough Transaction Types (98%


( Transactions)

• User needs & Functional terms (Design independent)

• Traceability to Requirements
Transaction - Flow Testing - Steps
1. Inspections, Reviews & Walkthroughs …

2. Design Tests for C1 + C2 coverage

3. Additional Coverage (> C1+C2)

• Paths with loops, extreme values, domain boundaries


• Weird cases, long & potentially troublesome Tr.

4. Design Test cases for Tr. Splits & mergers

5. Publish Selected Test Paths early

6. Buyer’s Acceptance – functional & acceptance tests


Transaction - Flow Testing Techniques
2. Path Selection

1. Covering Set (C1+C2) of Functionally Sensible Tr.

2. Add Difficult Paths

• Review with designers & implementers

• Exposure of interface problems & duplicated processing

• Very few Implementation bugs may remain

Transaction-flow Path Covering Set belongs in


System Feature Tests
ansaction - Flow Testing Techniques
3. Sensitization

1. Functionally Sensible Paths – Simple

2. Error, Exception, External Protocol Interface Paths - Difficult

Testing Tr.–Flows with External Interfaces

• Use patches & break points, mistune, and break the rules,
Transaction - Flow Testing Techniques
4. Instrumentation

1. Link Counters are not Useful.

2. Need

• Trace

• Queues on which Tokens resided

• Entries to & Exits from Dispatcher

• A Running Log
Make Instrumentation as part of System Design
Transaction - Flow Testing Techniques
5. Test Data bases

1. Design & Maintenance of a Test Data base - Effort

2. Mistakes

• Unawareness about design of a centrally administered test DB

• Test DB design by Testers

• Using one DB for all tests (need 4 to 5)

Need experienced System & Test Designers


Transaction - Flow Testing Techniques
6. Test Execution

1. Use Test Execution Automation

2. Have to do a large # of Tests for C1+C2 coverage


Transaction - Flow Testing - Implementation

1. Transaction based systems


• TCB

1. Centralized, Common Processing Queues


• Just O(n) Queues for Links of O(n2)

2. Transaction Dispatcher
• Uses tables & Finite State Machines

1. Recovery & Other Logs


• Key events in Tr – Flow
2. Self-Test Support
• Privileged modes in Transaction control tables

26
Transaction - Flow Testing - Caution
Hidden Languages (flow control language)

• Transaction Flows based on control codes in TCB or DB

• Undeclared. Syntax & Semantics are not debugged.

• Possibility of bugs
Software Testing Methodology

To Unit 2 : Data flow testing …

REF BORIS BEIZER 28


Data - Flow Testing - Basics
We will see in this part of Unit 2:

• Concepts of Data flows

• Data-flow testing strategies


Data - Flow Testing - Basics
Contents

• Synopsis

• Basics
• Intro to Data flow, data flow graphs
• Motivation & Assumption
• Data flow model

• Data Flow Testing Strategies


• General strategy
• Definitions
• Strategies:
• Slicing, Dicing, Data flow, Effectiveness

• Application of DFT, Tools & Effectiveness

REF BORIS BEIZER 30


a - Flow Testing - Basics

Anomaly

Unreasonable processing on data

• Use of data object before it is defined


• Defined data object is not used

• Data Flow Testing (DFT) uses Control Flow Graph (CFG) to explore dataflow
anomalies.

• DFT Leads to testing strategies between P and P1 / P2


REF BORIS BEIZER
Data - Flow Testing - Basics

Definition:

DFT is a family of test strategies based on selecting paths through the


program’s control flow in order to explore the sequence of events
related to the status of data objects.

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

• Confidence in the program

• Data dominated design. Code migrates to data..

• Source Code for Data Declarations

• Data flow Machines vs Von Neumann’s

• 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

Multiple representations of control flow graphs possible.


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 - Motivation

• Control flow graph


• Multiple representations

• Data Flow Graph

A spec. for relations among the data objects.

Covering DFG => Explore all relations under some test.


Data - Flow Testing - Basics

Assumptions

• Problems in a control flow

• Problems with data objects


Data - Flow Testing - Basics

Data Flow Graphs (DFG)

• It is a graph with nodes & directed links

• Test the Von Neumann way -

Convert to a CFG

Annotate : program actions (weights)


Data - Flow Testing - Basics
Data Object State & Usage

Program Actions (d, k, u):

Defined (created) - explicitly or implicitly (d)

Killed (released) - directly or indirectly (k)

Used - (u)

• In a calculation - (c)

• In a predicate - directly or indirectly (p)


Data - Flow Testing - Basics
Data Flow Anomalies
A Two letter sequence of Actions (d, k, u)
dd : harmless, suspicious
dk : probably a bug. A

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

- no action from START to this point


From this point till the EXIT
-d normal
-u anomaly
-k anomaly
k- normal
u- normal - possibly an anomaly

d- possibly anomalous
Data - Flow Testing - Basics

Data Flow Anomaly State graph

• Data Object State

• 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

Forgiving Data flow state graph u A  DD, DK, KU


k u KU
K k
k u

d DK
k
u d
k
U D d
u
d
DD
u
d
Data - Flow Testing - Basics
Data Flow State Graphs

• Differ in processing of anomalies

• Choice depends on Application, language, context


Data - Flow Testing - Basics

Static vs Dynamic Anomaly Detection

• Static analysis of data flows

• Dynamic analysis
Intermediate data values
Insufficiency of Static Analysis (for Data flow)

1. Validation of Dead Variables

2. Validation of pointers in Arrays

3. Validation of pointers for Records & pointers

1. Dynamic addresses for dynamic subroutine calls

2. Identifying False anomaly on an unachievable path

1. Recoverable anomalies & Alternate state graph

2. Concurrency, Interrupts, System Issues


REF BORIS BEIZER
48
Data - Flow Testing - Basics

Data Flow Model

• Based on CFG

• CFG annotated with program actions

• link weights : dk, dp, du etc..

• Not same as DFG

• For each variable and data object


Data - Flow Testing - Basics : Data Flow Model

Procedure to Build:

1. Entry & Exit nodes

1. Unique node identification

1. Weights on out link

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

A DFM for each variable

Single DFM for multiple variables

Use weights subscripted with variables


Data - Flow Testing – Data Flow Testing Strategies

• A structural testing strategy (path testing)

• Add, data flow strategies with link weights

• Test path segments to have a ‘d’ (or u, k, du, dk)


Data - Flow Testing – Data Flow Testing Strategies
DEFINITIONS

• w.r.t. a variable or data object ‘v’


• Assume all DF paths are achievable

1. Definition-clear path segment


no k, kd

2. Loop-free path segment

2. Simple path segment

3. du path from node i to k


• definition-clear & simple c
• definition-clear & loop-free p
Data - Flow Testing – Data Flow Testing Strategies
DFT Strategies

1. All-du paths (ADUP)

2. All uses (AU) strategy

3. All p-uses/some c-uses and All c-uses/some p-uses

1. All Definitions Strategy

1. All p-uses, All c-uses Strategy

Purpose:

Test Design, Develop Test Cases


Data - Flow Testing – Data Flow Testing Strategies
1. All-du paths (ADUP)

• Strongest DFT

• Every du path for every variable for every definition to every use

2. All uses (AU) strategy

• 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

3.All p-uses/some c-uses and All c-uses/some p-uses

•APU + c

• Stronger than P2

•ACU + p

• Weaker than P2
Data - Flow Testing – Data Flow Testing Strategies

4. All Definitions Strategy (AD)

• Cover every definition by at least one p or c

• Weaker than ACU + p and APU + c


Data - Flow Testing – Data Flow Testing Strategies

5. All-Predicate Uses, All-Computational Uses Strategy

• 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-uses Paths (AU)

All-c / some-p (ACU+p) All-p / some-c APU+c

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

Testing, Maintenance & Debugging in the Data Flow context

Dicing:
• A program dice is a part of slice in which all stmts. which are known to be
correct have been removed.

• Obtained from ‘slice’ by incorporating correctness information from


testing / debugging.
Data - Flow Testing – Data Flow Testing Strategies
Testing, Maintenance & Debugging in the Data Flow context

Debugging:

• Select a slice.

• Narrow it to a dice.

• Refine the dice till it’s one faulty stmt.


Data - Flow Testing – Data Flow Testing Strategies

Testing, Maintenance & Debugging in the Data Flow context

Dynamic Slicing:
• Refinement of static slicing

• Only achievable paths to the stmt ‘s’ in question are included.

Slicing methods bring together testing, maintenance & debugging .


Data - Flow Testing - – Data Flow Testing Strategies
Application of DFT

• Comparison Random Testing, P2, AU - by Ntafos

• AU detects more bugs than

• P2 with more test cases


• RT with less # of test cases

• Comparison of P2, AU - by Sneed

• AU detects more bugs with 90% Data Coverage Requirement.

REF BORIS BEIZER 72


Data - Flow Testing - – Data Flow Testing Strategies
Application of DFT

• Comparison of # test cases for ACU, APU, AU & ADUP

• by Weyuker using ASSET testing system

• Test Cases Normalized. t=a+b*d d = # binary decisions

• At most d+1 Test Cases for P2 loop-free

• # Test Cases / Decision

ADUP > AU > APU > ACU > revised-APU

REF BORIS BEIZER 73


Data - Flow Testing - – Data Flow Testing Strategies
Application of DFT

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

• Effort for Covering Path Set ~ Same

• DFT Tracks the Coverage of Variables

• Test Design is similar

REF BORIS BEIZER


Data - Flow Testing - – Data Flow Testing Strategies
DFT - TOOLS

• Cost-effective development

• Commercial tools :

• Can possibly do Better than Commercial Tools

• Easier Integration into a Compiler

• 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?

2. Explain the data flow Graphs (DFG).

3. How can anomaly be detected? Explain different types of data flow anomalies and Data flow
Anomaly State Graphs.

4. Write applications of Data Flow Testing.

5. Name and explain Data flow testing strategies.


Data - Flow Testing – Questions from the previous year’s exams

1. Distinguish Control Flow and Transaction flow.


2. What is meant by transaction flow testing. Discuss its significance.
3. Discuss in detail data - flow testing strategies.
4. What are data - flow anomalies? How data flow testing can explore them?
5. What are data-flow anomalies? How data flow testing can explore them?
6. What is meant by a program slice? Discuss about static and dynamic program slicing.
7. Explain the terms Dicing, Data-flow and Debugging.
8. What is meant by data flow model? Discuss various components of it?
9. Compare data flow and path flow testing strategies?
10.Explain data-flow testing with an example. Explain its generalizations and limitations.
Data - Flow Testing

To Unit 3… Domain Testing

You might also like