SlideShare a Scribd company logo
CONTROL FLOW TESTING
UNIT - 3
1
Prepared By: Ravi J Khimani, CSE Department, SLTIET, Rajkot
CONCEPTS
 Two kinds of Basic Statements in Program
 Assignment Statements
 Conditional Statements
 Conditional Statements alters the default
sequential control flow of program.
 A program unit must be having a proper entry-point
and exit-point, single or multiple.
 Sequence of instruction from Entry-Point to Exit-
Point is called Path. 2
CONCEPTS
 A specific input value causes a specific path to be
executed.
 That performs desired operations to produce
expected output.
 More execution of higher number of paths, at
higher cost, may not be effective to relieve defaults.
 Control Flow Testing is a kind of Structural Testing
which is performed by programmer to test code
written by them.
3
GENERATE TEST INPUT DATA FOR CFT
4
ACTIVITIES IN GENERATE TEST INPUT DATA
 Over all idea of generation test input data is to
perform control flow testing.
 Those activities performed and intermediate results
are produced.
 Input: Source Code & Set of Path Selection Criteria.
 Generation of a Control Flow Graph:
 aim to visualize all possible paths in program unit.
 Graphical Representation of execution.
5
ACTIVITIES IN GENERATE TEST INPUT DATA
 Selection of Paths:
 Paths are selected from CFG to satisfy Path Selection Criteria.
 Generation of a Test Input Data:
 A Path can be executed if and only if input to program unit
cause all conditional statements to true or false as per CFG.
 Such path is called Feasible Path.
 Otherwise it’s known as Infeasible Path.
6
ACTIVITIES IN GENERATE TEST INPUT DATA
 Feasibility Test of Path:
 Idea behind it to check the path is to meet the path selection
criteria.
 If some path founds to be infeasible, then new paths are
selected to be feasible.
7
CONTROL FLOW GRAPH
 A CFG is graphical representation of a program.
 Three symbols are used.
8
9
PATH REPRESENTATION
10
PATH SELECTION CRITERIA
 A Program Unit with small number of paths,
executing all paths may desirable and achievable.
 But if large number of paths, then executing all
path may not be practical.
 What paths do I select for testing?
 it is more productive for programmers to select a
small number of program paths in an effort to
reveal defects
11
ADVANTAGES OF PATH SELECTION
 Following, advantages of selecting paths based on
defined criteria:
 The programmer needs to observe the outcome of
executing each program construct.
 do not generate test inputs which execute the same
path repeatedly. It’s a waste of resources.
 If same path updates state of program, then repeat
execution of same path is not identical.
 Programmer can know the program features that have
been tested and those not tested
12
TECHNIQUES FOR PATH SELECTION
 All-Path coverage criteria
 If all-path are selected in CFG, then one can detect all
faults.
 Except those due to missing path error.
 Program may contain infinite number of paths.
 So, if all paths are selected to perform testing, then all-
path selection criteria has been satisfied.
13
FOR EXAMPLE - ALL-PATH COVERAGE CRITERIA
14
CFG
FOR
OPENFILES()
FUNCTION
15
INPUT DOMAIN AND PATHS
16
TECHNIQUES FOR PATH SELECTION [CONT…]
 Statement Coverage Criteria
 Refers to the individual program statement and
measure the outcome.
 100% achieved if all statements are executed.
 Its weakest coverage criteria.
 All program statements must be represent in CFG with
proper representation.
 So, basic problem is to select few feasible path for
covering all nodes in CFG.
 So, path length should be longer in increasingly
manner.
17
TECHNIQUES FOR PATH SELECTION [CONT…]
 Branch Coverage Criteria
 Each node in CFG may have one or two branches.
 Covering branch means selecting path that includes
that branch.
 Complete branch coverage means selecting a number
of paths such a way that all possible branches must be
included in those path.
18
TECHNIQUES FOR PATH SELECTION [CONT…]
 Predicate Coverage
Criteria
 Includes logic check
inside program, that
covers all
statements and
branch coverage
criteria.
19
TECHNIQUES FOR PATH SELECTION [CONT…]
 So need to design test cases that covers all the
possible conditions (logic).
 The False branch of node 5 (Figure 4.9a) is
executed under exactly one condition, namely,
when OB1 = False, OB2 = False, and OB3 = False,
whereas the true branch executes under seven 20
TECHNIQUES FOR PATH SELECTION [CONT…]
 If all possible combinations of truth values of the
conditions affecting a selected path have been
explored under some tests, then we say that
predicate coverage has been achieved.
 For Example, The path taking the true branch of
node 5 in Figure 4.9a must be executed for all
seven possible combinations of truth values of
OB1, OB2, and OB3 which result in OB = True.
21
GENERATING TEST INPUT
 After having an identified path, main question is
how to select input values?
 Such that, when program is executed with such
input values, the selected path gets executed.
 So, it needs to identify input to force path
execution.
22
GENERATING TEST INPUT
 For that some terms need to go through,
 1. Input Vector
 Collection of all data entities
 Fixed prior entering to routine / program.
 Like, input arguments, global variables, files, network
connections, timers, etc…
 For example, input vector for OPENFILE() function is
presence or absence of file1, file2, file3 and so on.
23
GENERATING TEST INPUT
 2. Predicate
 It’s a logical function evaluated at decision point.
 In this figure, OB is a predicate at decision point
24
GENERATING TEST INPUT
 3. Path Predicate
 It’s a set of predicates associated with the path.
25
GENERATING TEST INPUT
 4. Predicate Interpretation
 Predicate interpretation is defined as the process of
symbolically substituting operations along a path in
order to express the predicates solely in terms of the
input vector and a constant vector.
 Means, there is no role play of local variables inside
functions because they are not visible to outside
functions.
 Those local variables can be easily substituted by the
elements of input vector using symbolic substitution.
26
GENERATING TEST INPUT
27
GENERATING TEST INPUT
 5. Path Predicate Expression
 An interpreted path predicate is called a path predicate
expression with following properties.
 composed of input vector and constant vector
 set of constraints composed from input vector
 Forcing input values can be generated from constraints in path
predicate expression.
 If set of constraint can not be solved, then selected path can
not be executed.
 An infeasible path is not responsible for path predicate
expression, that dissatisfied.
 infeasibility of path forces to choose other path which meet
proper criteria. 28
GENERATING TEST INPUT
29
GENERATING TEST INPUT
 6. Generating Input Data from PPE
 The respective Path Predicate Expression must be
solved in order to generate input data which can force a
program to execute a selected path.
30
COINCIDENTAL CORRECTNESS
 In spite of the fault available in the code, some test
data produces the correct result, that’s known as
Coincidental Correctness.
 For Example,
31
Produces correct result in
CFG at slide number 9
CONTAIN INFEASIBLE PATH
 A CFG may contain number of paths, shorter or
longer.
 Not practical to execute or analyze all paths.
 So, define strategy like,
 Select as many as sort paths which are feasible
 Choose longer path to achieve coverage of statements,
predicates and branches.
 Reduce number of infeasible paths through language
design, program design, program transformations.
CONTAIN INFEASIBLE PATH
 Bertoline and Marre,
 gave an algorithm which generate set of feasible paths.
 Based on idea, Reduced Flow Graph, called ddgraph.
 Yates & Malevries,
 Suggests a strategy to select a path with minimum
number of predicates.

More Related Content

What's hot

Chapter 13 software testing strategies
Chapter 13 software testing strategiesChapter 13 software testing strategies
Chapter 13 software testing strategies
SHREEHARI WADAWADAGI
 
Software testing
Software testingSoftware testing
Software testing methods, levels and types
Software testing methods, levels and typesSoftware testing methods, levels and types
Software testing methods, levels and typesConfiz
 
Software testing and process
Software testing and processSoftware testing and process
Software testing and process
gouravkalbalia
 
verification and validation
verification and validationverification and validation
verification and validationDinesh Pasi
 
Se (techniques for black box testing ppt)
Se (techniques for black box testing ppt)Se (techniques for black box testing ppt)
Se (techniques for black box testing ppt)
Mani Kanth
 
Testing fundamentals
Testing fundamentalsTesting fundamentals
Testing fundamentals
Raviteja Chowdary Adusumalli
 
Static Testing
Static TestingStatic Testing
Static Testing
Dharita Chokshi
 
Software testing
Software testing Software testing
Software testing
Kunal Prajapati
 
Black box and white box testing
Black box and white box testingBlack box and white box testing
Black box and white box testing
AWADHESH PRATAP SINGH UNIVERSITY, REWA (M.P.)
 
Software quality assurance
Software quality assuranceSoftware quality assurance
Software quality assurance
Aman Adhikari
 
software testing methodologies
software testing methodologiessoftware testing methodologies
software testing methodologies
Jhonny Jhon
 
Unit testing
Unit testing Unit testing
Unit testing
Mani Kanth
 
What is Integration Testing? | Edureka
What is Integration Testing? | EdurekaWhat is Integration Testing? | Edureka
What is Integration Testing? | Edureka
Edureka!
 
Defect Testing in Software Engineering SE20
Defect Testing in Software Engineering SE20Defect Testing in Software Engineering SE20
Defect Testing in Software Engineering SE20koolkampus
 
Software testing
Software testingSoftware testing
Software testing
ssusere50573
 
Test cases
Test casesTest cases
Test cases
Chandra Maddigapu
 

What's hot (20)

Chapter 13 software testing strategies
Chapter 13 software testing strategiesChapter 13 software testing strategies
Chapter 13 software testing strategies
 
Software testing
Software testingSoftware testing
Software testing
 
Software testing methods, levels and types
Software testing methods, levels and typesSoftware testing methods, levels and types
Software testing methods, levels and types
 
White box ppt
White box pptWhite box ppt
White box ppt
 
Software testing and process
Software testing and processSoftware testing and process
Software testing and process
 
verification and validation
verification and validationverification and validation
verification and validation
 
Se (techniques for black box testing ppt)
Se (techniques for black box testing ppt)Se (techniques for black box testing ppt)
Se (techniques for black box testing ppt)
 
Testing
TestingTesting
Testing
 
Testing fundamentals
Testing fundamentalsTesting fundamentals
Testing fundamentals
 
Static Testing
Static TestingStatic Testing
Static Testing
 
Software testing
Software testing Software testing
Software testing
 
Black box and white box testing
Black box and white box testingBlack box and white box testing
Black box and white box testing
 
Software quality assurance
Software quality assuranceSoftware quality assurance
Software quality assurance
 
software testing methodologies
software testing methodologiessoftware testing methodologies
software testing methodologies
 
Unit testing
Unit testing Unit testing
Unit testing
 
What is Integration Testing? | Edureka
What is Integration Testing? | EdurekaWhat is Integration Testing? | Edureka
What is Integration Testing? | Edureka
 
5. scm
5. scm5. scm
5. scm
 
Defect Testing in Software Engineering SE20
Defect Testing in Software Engineering SE20Defect Testing in Software Engineering SE20
Defect Testing in Software Engineering SE20
 
Software testing
Software testingSoftware testing
Software testing
 
Test cases
Test casesTest cases
Test cases
 

Viewers also liked

Basis path testing
Basis path testingBasis path testing
Basis path testing
Hoa Le
 
Path testing
Path testingPath testing
Path testing
Mohamed Ali
 
Control Flow Analysis
Control Flow AnalysisControl Flow Analysis
Control Flow Analysis
Edgar Barbosa
 
Software Testing Techniques
Software Testing TechniquesSoftware Testing Techniques
Software Testing Techniques
Kiran Kumar
 
Software Testing
Software TestingSoftware Testing
Software Testing
Mousmi Pawar
 
Chapter 9 software maintenance
Chapter 9 software maintenanceChapter 9 software maintenance
Chapter 9 software maintenance
despicable me
 
Types of Software Testing
Types of Software TestingTypes of Software Testing
Types of Software TestingNishant Worah
 
Software Testing Fundamentals
Software Testing FundamentalsSoftware Testing Fundamentals
Software Testing FundamentalsChankey Pathak
 
Software testing ppt
Software testing pptSoftware testing ppt
Software testing ppt
Heritage Institute Of Tech,India
 
Green Path Criteria
Green Path CriteriaGreen Path Criteria
Green Path Criteria
cabq
 
An automatic test data generation for data flow
An automatic test data generation for data flowAn automatic test data generation for data flow
An automatic test data generation for data flow
WafaQKhan
 
Ab testing work flow
Ab testing work flowAb testing work flow
Ab testing work flowJainul Khan
 
Data flowtesting doc
Data flowtesting docData flowtesting doc
Data flowtesting docvamshi batchu
 
C++ material
C++ materialC++ material
C++ material
vamshi batchu
 
Transactionflow
TransactionflowTransactionflow
Transactionflow
vamshi batchu
 
Stm unit1
Stm unit1Stm unit1
Stm unit1
Chaitanya Kn
 
Testing
Testing Testing
Testing
vamshi batchu
 

Viewers also liked (19)

Basis path testing
Basis path testingBasis path testing
Basis path testing
 
Path testing
Path testingPath testing
Path testing
 
Control Flow Analysis
Control Flow AnalysisControl Flow Analysis
Control Flow Analysis
 
Software Testing Techniques
Software Testing TechniquesSoftware Testing Techniques
Software Testing Techniques
 
Software Testing
Software TestingSoftware Testing
Software Testing
 
Chapter 9 software maintenance
Chapter 9 software maintenanceChapter 9 software maintenance
Chapter 9 software maintenance
 
Types of Software Testing
Types of Software TestingTypes of Software Testing
Types of Software Testing
 
Software Testing Fundamentals
Software Testing FundamentalsSoftware Testing Fundamentals
Software Testing Fundamentals
 
Software testing ppt
Software testing pptSoftware testing ppt
Software testing ppt
 
Green Path Criteria
Green Path CriteriaGreen Path Criteria
Green Path Criteria
 
An automatic test data generation for data flow
An automatic test data generation for data flowAn automatic test data generation for data flow
An automatic test data generation for data flow
 
CALIDAD ESPERA
CALIDAD ESPERACALIDAD ESPERA
CALIDAD ESPERA
 
Ab testing work flow
Ab testing work flowAb testing work flow
Ab testing work flow
 
Data flowtesting doc
Data flowtesting docData flowtesting doc
Data flowtesting doc
 
C++ material
C++ materialC++ material
C++ material
 
software testing
software testingsoftware testing
software testing
 
Transactionflow
TransactionflowTransactionflow
Transactionflow
 
Stm unit1
Stm unit1Stm unit1
Stm unit1
 
Testing
Testing Testing
Testing
 

Similar to Unit 3 Control Flow Testing

1414_lecturueueueueuueueeueueueuusuee_7.ppt
1414_lecturueueueueuueueeueueueuusuee_7.ppt1414_lecturueueueueuueueeueueueuusuee_7.ppt
1414_lecturueueueueuueueeueueueuusuee_7.ppt
abdulbasetalselwi
 
Sta unit 4(abimanyu)
Sta unit 4(abimanyu)Sta unit 4(abimanyu)
Sta unit 4(abimanyu)
Abhimanyu Mishra
 
7-White Box Testing.ppt
7-White Box Testing.ppt7-White Box Testing.ppt
7-White Box Testing.ppt
HirenderPal
 
Software Testing Tecniques
Software Testing TecniquesSoftware Testing Tecniques
Software Testing Tecniquesersanbilik
 
A WHITE BOX TESTING TECHNIQUE IN SOFTWARE TESTING : BASIS PATH TESTING
A WHITE BOX TESTING TECHNIQUE IN SOFTWARE TESTING : BASIS PATH TESTINGA WHITE BOX TESTING TECHNIQUE IN SOFTWARE TESTING : BASIS PATH TESTING
A WHITE BOX TESTING TECHNIQUE IN SOFTWARE TESTING : BASIS PATH TESTING
Journal For Research
 
Ch4-ControlFlowTesting.ppt
Ch4-ControlFlowTesting.pptCh4-ControlFlowTesting.ppt
Ch4-ControlFlowTesting.ppt
BUSHRASHAIKH804312
 
Qat09 presentations dxw07u
Qat09 presentations dxw07uQat09 presentations dxw07u
Qat09 presentations dxw07uShubham Sharma
 
A Path-Oriented Automatic Random Testing Based on Double Constraint Propagation
A Path-Oriented Automatic Random Testing Based on Double Constraint PropagationA Path-Oriented Automatic Random Testing Based on Double Constraint Propagation
A Path-Oriented Automatic Random Testing Based on Double Constraint Propagation
ijseajournal
 
White Box Testing And Control Flow & Loop Testing
White Box Testing And Control Flow & Loop TestingWhite Box Testing And Control Flow & Loop Testing
White Box Testing And Control Flow & Loop TestingAnkit Mulani
 
Calculation of Cyclomatic complexity
Calculation of Cyclomatic complexityCalculation of Cyclomatic complexity
Calculation of Cyclomatic complexity
nikshaikh786
 
Software Engineering (Testing techniques)
Software Engineering (Testing techniques)Software Engineering (Testing techniques)
Software Engineering (Testing techniques)
ShudipPal
 
Software Engineering (Testing techniques)
Software Engineering (Testing techniques)Software Engineering (Testing techniques)
Software Engineering (Testing techniques)
ShudipPal
 
SE UNIT 5 part 2 (1).pptx
SE UNIT 5 part 2 (1).pptxSE UNIT 5 part 2 (1).pptx
SE UNIT 5 part 2 (1).pptx
PraneethBhai1
 
Chapter 8 Testing Tactics.ppt Software engineering
Chapter 8 Testing Tactics.ppt Software engineeringChapter 8 Testing Tactics.ppt Software engineering
Chapter 8 Testing Tactics.ppt Software engineering
AnasHassan52
 
Path testing, data flow testing
Path testing, data flow testingPath testing, data flow testing
Path testing, data flow testing
priyasoundar
 
RPG Program for Unit Testing RPG
RPG Program for Unit Testing RPG RPG Program for Unit Testing RPG
RPG Program for Unit Testing RPG
Greg.Helton
 
ISTQB Advanced Study Guide - 5
ISTQB Advanced Study Guide - 5ISTQB Advanced Study Guide - 5
ISTQB Advanced Study Guide - 5
Yogindernath Gupta
 
Chapter 8 Testing Tactics.ppt
Chapter 8 Testing Tactics.pptChapter 8 Testing Tactics.ppt
Chapter 8 Testing Tactics.ppt
VijayaPratapReddyM
 
STesting (Unit-II).ppt
STesting (Unit-II).pptSTesting (Unit-II).ppt
STesting (Unit-II).ppt
SouravMohanty43
 
Quality Assurance
Quality AssuranceQuality Assurance
Quality Assurance
Kiran Kumar
 

Similar to Unit 3 Control Flow Testing (20)

1414_lecturueueueueuueueeueueueuusuee_7.ppt
1414_lecturueueueueuueueeueueueuusuee_7.ppt1414_lecturueueueueuueueeueueueuusuee_7.ppt
1414_lecturueueueueuueueeueueueuusuee_7.ppt
 
Sta unit 4(abimanyu)
Sta unit 4(abimanyu)Sta unit 4(abimanyu)
Sta unit 4(abimanyu)
 
7-White Box Testing.ppt
7-White Box Testing.ppt7-White Box Testing.ppt
7-White Box Testing.ppt
 
Software Testing Tecniques
Software Testing TecniquesSoftware Testing Tecniques
Software Testing Tecniques
 
A WHITE BOX TESTING TECHNIQUE IN SOFTWARE TESTING : BASIS PATH TESTING
A WHITE BOX TESTING TECHNIQUE IN SOFTWARE TESTING : BASIS PATH TESTINGA WHITE BOX TESTING TECHNIQUE IN SOFTWARE TESTING : BASIS PATH TESTING
A WHITE BOX TESTING TECHNIQUE IN SOFTWARE TESTING : BASIS PATH TESTING
 
Ch4-ControlFlowTesting.ppt
Ch4-ControlFlowTesting.pptCh4-ControlFlowTesting.ppt
Ch4-ControlFlowTesting.ppt
 
Qat09 presentations dxw07u
Qat09 presentations dxw07uQat09 presentations dxw07u
Qat09 presentations dxw07u
 
A Path-Oriented Automatic Random Testing Based on Double Constraint Propagation
A Path-Oriented Automatic Random Testing Based on Double Constraint PropagationA Path-Oriented Automatic Random Testing Based on Double Constraint Propagation
A Path-Oriented Automatic Random Testing Based on Double Constraint Propagation
 
White Box Testing And Control Flow & Loop Testing
White Box Testing And Control Flow & Loop TestingWhite Box Testing And Control Flow & Loop Testing
White Box Testing And Control Flow & Loop Testing
 
Calculation of Cyclomatic complexity
Calculation of Cyclomatic complexityCalculation of Cyclomatic complexity
Calculation of Cyclomatic complexity
 
Software Engineering (Testing techniques)
Software Engineering (Testing techniques)Software Engineering (Testing techniques)
Software Engineering (Testing techniques)
 
Software Engineering (Testing techniques)
Software Engineering (Testing techniques)Software Engineering (Testing techniques)
Software Engineering (Testing techniques)
 
SE UNIT 5 part 2 (1).pptx
SE UNIT 5 part 2 (1).pptxSE UNIT 5 part 2 (1).pptx
SE UNIT 5 part 2 (1).pptx
 
Chapter 8 Testing Tactics.ppt Software engineering
Chapter 8 Testing Tactics.ppt Software engineeringChapter 8 Testing Tactics.ppt Software engineering
Chapter 8 Testing Tactics.ppt Software engineering
 
Path testing, data flow testing
Path testing, data flow testingPath testing, data flow testing
Path testing, data flow testing
 
RPG Program for Unit Testing RPG
RPG Program for Unit Testing RPG RPG Program for Unit Testing RPG
RPG Program for Unit Testing RPG
 
ISTQB Advanced Study Guide - 5
ISTQB Advanced Study Guide - 5ISTQB Advanced Study Guide - 5
ISTQB Advanced Study Guide - 5
 
Chapter 8 Testing Tactics.ppt
Chapter 8 Testing Tactics.pptChapter 8 Testing Tactics.ppt
Chapter 8 Testing Tactics.ppt
 
STesting (Unit-II).ppt
STesting (Unit-II).pptSTesting (Unit-II).ppt
STesting (Unit-II).ppt
 
Quality Assurance
Quality AssuranceQuality Assurance
Quality Assurance
 

Recently uploaded

addressing modes in computer architecture
addressing modes  in computer architectureaddressing modes  in computer architecture
addressing modes in computer architecture
ShahidSultan24
 
Courier management system project report.pdf
Courier management system project report.pdfCourier management system project report.pdf
Courier management system project report.pdf
Kamal Acharya
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Teleport Manpower Consultant
 
The Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfThe Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdf
Pipe Restoration Solutions
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
gdsczhcet
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
Jayaprasanna4
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Dr.Costas Sachpazis
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
Forklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella PartsForklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella Parts
Intella Parts
 
Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.
PrashantGoswami42
 
LIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.pptLIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.ppt
ssuser9bd3ba
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
Osamah Alsalih
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
bakpo1
 
The role of big data in decision making.
The role of big data in decision making.The role of big data in decision making.
The role of big data in decision making.
ankuprajapati0525
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
Robbie Edward Sayers
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
AJAYKUMARPUND1
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
fxintegritypublishin
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
Kamal Acharya
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
Kamal Acharya
 
Halogenation process of chemical process industries
Halogenation process of chemical process industriesHalogenation process of chemical process industries
Halogenation process of chemical process industries
MuhammadTufail242431
 

Recently uploaded (20)

addressing modes in computer architecture
addressing modes  in computer architectureaddressing modes  in computer architecture
addressing modes in computer architecture
 
Courier management system project report.pdf
Courier management system project report.pdfCourier management system project report.pdf
Courier management system project report.pdf
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
 
The Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfThe Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdf
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
 
Forklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella PartsForklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella Parts
 
Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.
 
LIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.pptLIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.ppt
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
 
The role of big data in decision making.
The role of big data in decision making.The role of big data in decision making.
The role of big data in decision making.
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
 
Halogenation process of chemical process industries
Halogenation process of chemical process industriesHalogenation process of chemical process industries
Halogenation process of chemical process industries
 

Unit 3 Control Flow Testing

  • 1. CONTROL FLOW TESTING UNIT - 3 1 Prepared By: Ravi J Khimani, CSE Department, SLTIET, Rajkot
  • 2. CONCEPTS  Two kinds of Basic Statements in Program  Assignment Statements  Conditional Statements  Conditional Statements alters the default sequential control flow of program.  A program unit must be having a proper entry-point and exit-point, single or multiple.  Sequence of instruction from Entry-Point to Exit- Point is called Path. 2
  • 3. CONCEPTS  A specific input value causes a specific path to be executed.  That performs desired operations to produce expected output.  More execution of higher number of paths, at higher cost, may not be effective to relieve defaults.  Control Flow Testing is a kind of Structural Testing which is performed by programmer to test code written by them. 3
  • 4. GENERATE TEST INPUT DATA FOR CFT 4
  • 5. ACTIVITIES IN GENERATE TEST INPUT DATA  Over all idea of generation test input data is to perform control flow testing.  Those activities performed and intermediate results are produced.  Input: Source Code & Set of Path Selection Criteria.  Generation of a Control Flow Graph:  aim to visualize all possible paths in program unit.  Graphical Representation of execution. 5
  • 6. ACTIVITIES IN GENERATE TEST INPUT DATA  Selection of Paths:  Paths are selected from CFG to satisfy Path Selection Criteria.  Generation of a Test Input Data:  A Path can be executed if and only if input to program unit cause all conditional statements to true or false as per CFG.  Such path is called Feasible Path.  Otherwise it’s known as Infeasible Path. 6
  • 7. ACTIVITIES IN GENERATE TEST INPUT DATA  Feasibility Test of Path:  Idea behind it to check the path is to meet the path selection criteria.  If some path founds to be infeasible, then new paths are selected to be feasible. 7
  • 8. CONTROL FLOW GRAPH  A CFG is graphical representation of a program.  Three symbols are used. 8
  • 9. 9
  • 11. PATH SELECTION CRITERIA  A Program Unit with small number of paths, executing all paths may desirable and achievable.  But if large number of paths, then executing all path may not be practical.  What paths do I select for testing?  it is more productive for programmers to select a small number of program paths in an effort to reveal defects 11
  • 12. ADVANTAGES OF PATH SELECTION  Following, advantages of selecting paths based on defined criteria:  The programmer needs to observe the outcome of executing each program construct.  do not generate test inputs which execute the same path repeatedly. It’s a waste of resources.  If same path updates state of program, then repeat execution of same path is not identical.  Programmer can know the program features that have been tested and those not tested 12
  • 13. TECHNIQUES FOR PATH SELECTION  All-Path coverage criteria  If all-path are selected in CFG, then one can detect all faults.  Except those due to missing path error.  Program may contain infinite number of paths.  So, if all paths are selected to perform testing, then all- path selection criteria has been satisfied. 13
  • 14. FOR EXAMPLE - ALL-PATH COVERAGE CRITERIA 14
  • 16. INPUT DOMAIN AND PATHS 16
  • 17. TECHNIQUES FOR PATH SELECTION [CONT…]  Statement Coverage Criteria  Refers to the individual program statement and measure the outcome.  100% achieved if all statements are executed.  Its weakest coverage criteria.  All program statements must be represent in CFG with proper representation.  So, basic problem is to select few feasible path for covering all nodes in CFG.  So, path length should be longer in increasingly manner. 17
  • 18. TECHNIQUES FOR PATH SELECTION [CONT…]  Branch Coverage Criteria  Each node in CFG may have one or two branches.  Covering branch means selecting path that includes that branch.  Complete branch coverage means selecting a number of paths such a way that all possible branches must be included in those path. 18
  • 19. TECHNIQUES FOR PATH SELECTION [CONT…]  Predicate Coverage Criteria  Includes logic check inside program, that covers all statements and branch coverage criteria. 19
  • 20. TECHNIQUES FOR PATH SELECTION [CONT…]  So need to design test cases that covers all the possible conditions (logic).  The False branch of node 5 (Figure 4.9a) is executed under exactly one condition, namely, when OB1 = False, OB2 = False, and OB3 = False, whereas the true branch executes under seven 20
  • 21. TECHNIQUES FOR PATH SELECTION [CONT…]  If all possible combinations of truth values of the conditions affecting a selected path have been explored under some tests, then we say that predicate coverage has been achieved.  For Example, The path taking the true branch of node 5 in Figure 4.9a must be executed for all seven possible combinations of truth values of OB1, OB2, and OB3 which result in OB = True. 21
  • 22. GENERATING TEST INPUT  After having an identified path, main question is how to select input values?  Such that, when program is executed with such input values, the selected path gets executed.  So, it needs to identify input to force path execution. 22
  • 23. GENERATING TEST INPUT  For that some terms need to go through,  1. Input Vector  Collection of all data entities  Fixed prior entering to routine / program.  Like, input arguments, global variables, files, network connections, timers, etc…  For example, input vector for OPENFILE() function is presence or absence of file1, file2, file3 and so on. 23
  • 24. GENERATING TEST INPUT  2. Predicate  It’s a logical function evaluated at decision point.  In this figure, OB is a predicate at decision point 24
  • 25. GENERATING TEST INPUT  3. Path Predicate  It’s a set of predicates associated with the path. 25
  • 26. GENERATING TEST INPUT  4. Predicate Interpretation  Predicate interpretation is defined as the process of symbolically substituting operations along a path in order to express the predicates solely in terms of the input vector and a constant vector.  Means, there is no role play of local variables inside functions because they are not visible to outside functions.  Those local variables can be easily substituted by the elements of input vector using symbolic substitution. 26
  • 28. GENERATING TEST INPUT  5. Path Predicate Expression  An interpreted path predicate is called a path predicate expression with following properties.  composed of input vector and constant vector  set of constraints composed from input vector  Forcing input values can be generated from constraints in path predicate expression.  If set of constraint can not be solved, then selected path can not be executed.  An infeasible path is not responsible for path predicate expression, that dissatisfied.  infeasibility of path forces to choose other path which meet proper criteria. 28
  • 30. GENERATING TEST INPUT  6. Generating Input Data from PPE  The respective Path Predicate Expression must be solved in order to generate input data which can force a program to execute a selected path. 30
  • 31. COINCIDENTAL CORRECTNESS  In spite of the fault available in the code, some test data produces the correct result, that’s known as Coincidental Correctness.  For Example, 31 Produces correct result in CFG at slide number 9
  • 32. CONTAIN INFEASIBLE PATH  A CFG may contain number of paths, shorter or longer.  Not practical to execute or analyze all paths.  So, define strategy like,  Select as many as sort paths which are feasible  Choose longer path to achieve coverage of statements, predicates and branches.  Reduce number of infeasible paths through language design, program design, program transformations.
  • 33. CONTAIN INFEASIBLE PATH  Bertoline and Marre,  gave an algorithm which generate set of feasible paths.  Based on idea, Reduced Flow Graph, called ddgraph.  Yates & Malevries,  Suggests a strategy to select a path with minimum number of predicates.