White-Box Testing Techniques II Originals prepared by Stephen M. Thebaut, Ph.D. University of Florida Dataflow Testing.

Slides:



Advertisements
Similar presentations
Data Flow Coverage. Reading assignment L. A. Clarke, A. Podgurski, D. J. Richardson and Steven J. Zeil, "A Formal Evaluation of Data Flow Path Selection.
Advertisements

White-Box Testing Techniques IV
Paul Ammann & Jeff Offutt
Introduction to Software Testing Chapter 2.1, 2.2 Overview Graph Coverage Criteria Paul Ammann & Jeff Offutt
Lecture 2 White-box Testing and Structural Coverage.
The Application of Graph Criteria: Source Code  It is usually defined with the control flow graph (CFG)  Node coverage is used to execute every statement.
Unit Testing CSSE 376, Software Quality Assurance Rose-Hulman Institute of Technology March 27, 2007.
Software Testing Sudipto Ghosh CS 406 Fall 99 November 16, 1999.
Software Testing and Quality Assurance
Handouts Software Testing and Quality Assurance Theory and Practice Chapter 5 Data Flow Testing
SOFTWARE TESTING WHITE BOX TESTING 1. GLASS BOX/WHITE BOX TESTING 2.
Topics in Software Dynamic White-box Testing: Data-flow Testing
Topics in Software Dynamic White-box Testing Part 2: Data-flow Testing
Data Flow Testing Data flow testing(DFT) is NOT directly related to the design diagrams of data-flow-diagrams(DFD). It is a form of structural testing.
Introduction to Software Testing Chapter 2.3 Graph Coverage for Source Code Paul Ammann & Jeff Offutt
Paul Ammann & Jeff Offutt
Software testing techniques Testing criteria based on data flow
Presented By Dr. Shazzad Hosain Asst. Prof., EECS, NSU
Data Flow Testing Chapter Data Flow Testing Testing All-Nodes and All-Edges in a control flow graph may miss significant test cases Testing All-Paths.
White-Box Testing Eshcar Hillel Michael Beder. White Box Testing 2 Tutorial Outline What is White Box Testing? Flow Graph and Coverage Types Symbolic.
1 ECE 453 – CS 447 – SE 465 Software Testing & Quality Assurance Instructor Kostas Kontogiannis.
Course Outline Traditional Static Program Analysis –Theory –Classic analysis and applications Points-to analysis, CHA, RTA –The Soot analysis framework.
Overview Graph Coverage Criteria ( Introduction to Software Testing Chapter 2.1, 2.2) Paul Ammann & Jeff Offutt.
Final Review  Different tests  Boundary Value Testing  Equivalence Class Testing  Decision Table Based Testing  Path Testing  Data Flow & P-Slice.
Test Coverage CS-300 Fall 2005 Supreeth Venkataraman.
White-Box Software Testing Methods Speaker: Jerry Gao Ph.D. San Jose State University URL:
Introduction to Software Testing Chapter 2.3 Graph Coverage for Source Code Paul Ammann & Jeff Offutt
Software Verification Graph Model. 2 Graph Coverage Four Structures for Modeling Software Graphs Logic Input Space Syntax Use cases Specs Design Source.
Paul Ammann & Jeff Offutt
Software Testing and Maintenance Lecture 2.1 Overview Graph Coverage
Overview Structural Testing Introduction – General Concepts
1 Graph Coverage (3). Reading Assignment P. Ammann and J. Offutt “Introduction to Software Testing” ◦ Section 2.2 ◦ Section
1 Software Testing & Quality Assurance Lecture 13 Created by: Paulo Alencar Modified by: Frank Xu.
Control Flow Graphs : The if Statement 1 if (x < y) { y = 0; x = x + 1; } else { x = y; } x >= yx < y x = y y = 0 x = x + 1 if (x < y) { y = 0;
1 Test Coverage Coverage can be based on: –source code –object code –model –control flow graph –(extended) finite state machines –data flow graph –requirements.
Data Flow Coverage Criteria
White-Box Testing Techniques I Prepared by Stephen M. Thebaut, Ph.D. University of Florida Software Testing and Verification Lecture 7.
Software Testing and Maintenance Lecture 3 Graph Coverage for Source Code Paul Ammann & Jeff Offutt Instructor: Hossein Momeni Mazandaran.
Data Flow Testing. Introduction to Software Testing (Ch 2) © Ammann & Offutt 2 Definition of a Graph A set N of nodes, N is not empty A set N 0 of initial.
Software Dynamic White-box Testing Part 2: Data-flow Testing Lecture 7 Prof. Mostafa Abdel Aziem Mostafa.
Chapter 2 : Graph Coverage (part 2)
White-Box Testing Techniques. Definition of White-Box Testing Testing based on analysis of internal logic (design, code, etc.). (But expected results.
Software Testing and QA Theory and Practice (Chapter 5: Data Flow Testing) © Naik & Tripathy 1 Software Testing and Quality Assurance Theory and Practice.
Paul Ammann & Jeff Offutt
Software TestIng White box testing.
Paul Ammann & Jeff Offutt
Handouts Software Testing and Quality Assurance Theory and Practice Chapter 4 Control Flow Testing
White-Box Testing Techniques IV
Software Testing and Maintenance 1
Paul Ammann & Jeff Offutt
Paul Ammann & Jeff Offutt
Paul Ammann & Jeff Offutt
Structural testing, Path Testing
White-Box Testing Techniques
Prepared by Stephen M. Thebaut, Ph.D. University of Florida
White-Box Testing Techniques II
Dataflow Testing G. Rothermel.
White-Box Testing Techniques III
White-Box Testing Techniques II
White-Box Testing Techniques III
Sudipto Ghosh CS 406 Fall 99 November 16, 1999
Graph Coverage for Source Code
White-Box Testing Techniques I
Graph Coverage Criteria
White-Box Testing Techniques II
Graph Coverage Criteria
Paul Ammann & Jeff Offutt
Paul Ammann & Jeff Offutt
Software Testing and QA Theory and Practice (Chapter 5: Data Flow Testing) © Naik & Tripathy 1 Software Testing and Quality Assurance Theory and Practice.
Presentation transcript:

White-Box Testing Techniques II Originals prepared by Stephen M. Thebaut, Ph.D. University of Florida Dataflow Testing

White-Box Testing Topics Logic coverage Dataflow coverage Path conditions and symbolic execution (lecture III) Other white-box testing strategies –e.g. fault-based testing

Dataflow Coverage Basic idea: –Program paths along which variables are defined and then used should be covered A family of path selection criteria has been defined, each providing a different degree of coverage CASE tool support is very desirable

Variable Definition A program variable is DEFINED when it appears: –on the left hand side of an assignment statement eg y = 17 –in an input statement eg read(y) –as an call-by-reference parameter in a subroutine call eg update(x, &y);

Variable Use A program variable is USED when it appears: –on the right hand side of an assignment statement eg y = x+17 –as an call-by-value parameter in a subroutine or function call eg y = sqrt(x) –in the predicate of a branch statement eg if ( x > 0 ) { … }

Variable Use: p-use and c-use Use in the predicate of a branch statement is a predicate-use or “p- use” Any other use is a computation-use or “c-use” For example, in the program fragment: if ( x > 0 ) { print(y); } there is a p-use of x and a c-use of y

Variable Use A variable can also be used and then re- defined in a single statement when it appears: –on both sides of an assignment statement eg y = y + x –as an call-by-reference parameter in a subroutine call eg increment( &y )

More Dataflow Terms and Definitions A path is definition clear (“def-clear”) with respect to a variable v if it has no variable re-definition of v on the path A complete path is a path whose initial node is a start node and whose final node is an exit node

Dataflow Terms and Definitions A definition-use pair (“du-pair”) with respect to a variable v is a double (d,u) such that –d is a node in the program’s flow graph at which v is defined, –u is a node or edge at which v is used and –there is a def-clear path with respect to v from d to u Note that the definition of a du-pair does not require the existence of a feasible def-clear path from d to u

Example 1 1. input(A,B) if (B>1) { 2. A = A+7 } 3. if (A>10) { 4. B = A+B } 5. output(A,B) input(A,B) A = A+7 B = A+B B>1 B1B1 A>10 A  10 output(A,B)

Identifying DU-Pairs – Variable A du-pairpath(s) (1,2) (1,4) (1,5) (1, ) (1, ) (2,4) (2,5) (2, ) (2, ) input(A,B) A := A+7 B := A+B B>1 B1B1 A>10 A  10 output(A,B)

Identifying DU-Pairs – Variable A du-pairpath(s) (1,2) (1,4) (1,5) (1, ) (1, ) (2,4) (2,5) (2, ) (2, ) input( A,B) A := A +7 B := A+B B>1 B1B1 A>10 A  10 output(A,B)

Identifying DU-Pairs – Variable A du-pairpath(s) (1,2) (1,4) (1,5) (1, ) (1, ) (2,4) (2,5) (2, ) (2, ) input( A,B) A := A+7 B := A +B B>1 B1B1 A>10 A  10 output(A,B)

Identifying DU-Pairs – Variable A du-pairpath(s) (1,2) (1,4) (1,5) (1, ) (1, ) (2,4) (2,5) (2, ) (2, ) input( A,B) A := A+7 B := A+B B>1 B1B1 A>10 A  10 output( A,B)

Identifying DU-Pairs – Variable A du-pairpath(s) (1,2) (1,4) (1,5) (1, ) (1, ) (2,4) (2,5) (2, ) (2, ) input( A,B) A := A+7 B := A+B B>1 B1B1 A>10 A  10 output( A,B)

Identifying DU-Pairs – Variable A du-pairpath(s) (1,2) (1,4) (1,5) (1, ) (1, ) (2,4) (2,5) (2, ) (2, ) input( A,B) A := A+7 B := A+B B>1 B1B1 A >10 A  10 output(A,B)

Identifying DU-Pairs – Variable A du-pairpath(s) (1,2) (1,4) (1,5) (1, ) (1, ) (2,4) (2,5) (2, ) (2, ) input( A,B) A := A+7 B := A+B B>1 B1B1 A>10 A  10 output(A,B)

Identifying DU-Pairs – Variable A du-pairpath(s) (1,2) (1,4) (1,5) (1, ) (1, ) (2,4) (2,5) (2, ) (2, ) input(A,B) A := A+7 B := A +B B>1 B1B1 A>10 A  10 output(A,B)

Identifying DU-Pairs – Variable A du-pairpath(s) (1,2) (1,4) (1,5) (1, ) (1, ) (2,4) (2,5) (2, ) (2, ) input(A,B) A := A+7 B := A+B B>1 B1B1 A>10 A  10 output( A,B)

Identifying DU-Pairs – Variable A du-pairpath(s) (1,2) (1,4) (1,5) (1, ) (1, ) (2,4) (2,5) (2, ) (2, ) input(A,B) A := A+7 B := A+B B>1 B1B1 A>10 A  10 output( A,B)

Identifying DU-Pairs – Variable A du-pairpath(s) (1,2) (1,4) (1,5) (1, ) (1, ) (2,4) (2,5) (2, ) (2, ) input(A,B) A := A+7 B := A+B B>1 B1B1 A >10 A  10 output(A,B)

Identifying DU-Pairs – Variable A du-pairpath(s) (1,2) (1,4) (1,5) (1, ) (1, ) (2,4) (2,5) (2, ) (2, ) input(A,B) A := A+7 B := A+B B>1 B1B1 A>10 A  10 output(A,B)

Identifying DU-Pairs – Variable B du-pairpath(s) (1,4) (1,5) (1, ) (1, ) (4,5) input(A,B) A := A+7 B := A+B B>1 B1B1 A>10 A  10 output(A,B)

Dataflow Test Coverage Criteria All-Defs for every program variable v, at least one def-clear path from every definition of v to at least one c-use or one p-use of v must be covered

Dataflow Test Coverage Criteria Consider a test case executing path: 1. Identify all def-clear paths covered ( ie subsumed) by this path for each variable Are all definitions for each variable associated with at least one of the subsumed def-clear paths?

Def-Clear Paths subsumed by for Variable A du-pairpath(s) (1,2)  (1,4) (1,5) (1, ) (1, ) (2,4)  (2,5)  (2, )  (2, ) input(A,B) A := A+7 B := A+B B>1 B1B1 A>10 A  10 output(A,B)

Def-Clear Paths Subsumed by for Variable B du-pairpath(s) (1,4)  (1,5) (4,5)  (1, )  (1, ) input(A,B) A := A+7 B := A+B B>1 B1B1 A>10 A  10 output(A,B)

Dataflow Test Coverage Criteria Since covers at least one def- clear path from every definition of A or B to at least one c-use or p-use of A or B, All-Defs coverage is achieved

Dataflow Test Coverage Criteria All-Uses: for every program variable v, at least one def-clear path from every definition of v to every c-use and every p-use of v must be covered Consider additional test cases executing paths: Do all three test cases provide All-Uses coverage?

Def-Clear Paths Subsumed by for Variable A du-pairpath(s) (1,2)  (1,4)  (1,5)  (1, )  (1, ) (2,4)  (2,5)  (2, )  (2, ) input(A,B) A := A+7 B := A+B B>1 B1B1 A>10 A  10 output(A,B)

Def-Clear Paths Subsumed by for Variable B du-pairpath(s) (1,4)  (1,5) (4,5)  (1, )  (1, )  input(A,B) A := A+7 B := A+B B>1 B1B1 A>10 A  10 output(A,B)

Def-Clear Paths Subsumed by for Variable A du-pairpath(s) (1,2)   (1,4)  (1,5)  (1, )  (1, ) (2,4)  (2,5)  (2, )  (2, )  input(A,B) A := A+7 B := A+B B>1 B1B1 A>10 A  10 output(A,B)

Def-Clear Paths Subsumed by for Variable B du-pairpath(s) (1,4)  (1,5)  (4,5)  (1, )   (1, )  input(A,B) A := A+7 B := A+B B>1 B1B1 A>10 A  10 output(A,B)

Dataflow Test Coverage Criteria None of the three test cases covers the du-pair (1, ) for variable A, All-Uses Coverage is not achieved

Example 2 1. input (X,Y) 2. while (Y>0) { 3. if (X>0) 4. Y := Y-X else 5. input (X) 6. } 7. output (X,Y) 1 3 input(X,Y)) Y := Y-Xinput(X) Y>0 Y0Y0 X>0 output(X,Y) X0X Y>0 Y0Y0

Identifying DU-Pairs – Variable X du-pairpath(s) (1,4) (1,7) (1, ) (1, ) (5,4) 1 3 input(X,Y)) Y := Y-Xinput(X) Y>0 Y0Y0 X>0 output(X,Y) X0X Y>0 Y0Y0

Identifying DU-Pairs – Variable X du-pairpath(s) (1,4) (1,7) (1, ) (1, ) (5,4) 1 3 input( X,Y)) Y := Y- X input(X) Y>0 Y0Y0 X>0 output(X,Y) X0X Y>0 Y0Y0

Identifying DU-Pairs – Variable X du-pairpath(s) (1,4) (1,7) (1, ) (1, ) (5,4) 1 3 input( X,Y)) Y = Y- X input(X) Y>0 Y0Y0 X>0 output(X,Y) X0X Y>0 Y0Y0

Identifying DU-Pairs – Variable X du-pairpath(s) (1,4) (1,7) (1, ) (1, ) (5,4) 1 3 input( X,Y)) Y = Y- X input(X) Y>0 Y0Y0 X>0 output(X,Y) X0X Y>0 Y0Y0

Identifying DU-Pairs – Variable X du-pairpath(s) (1,4) (1,7) (1, ) (1, ) (5,4) 1 3 input(X,Y)) Y = Y-Xinput(X) Y>0 Y0Y0 X>0 output(X,Y) X0X Y>0 Y0Y0

Identifying DU-Pairs – Variable X du-pairpath(s) (1,4) (1,7) (1, ) (1, ) (5,4) 1 3 input(X,Y)) Y = Y-Xinput(X) Y>0 Y0Y0 X>0 output(X,Y) X0X Y>0 Y0Y0

Identifying DU-Pairs – Variable X du-pairpath(s) (1,4) (1,7) (1, ) (1, ) (5,4) 1 3 input(X,Y)) Y = Y-Xinput(X) Y>0 Y0Y0 X>0 output(X,Y) X0X Y>0 Y0Y0

Identifying DU-Pairs – Variable X du-pairpath(s) (1,4) (1,7) (1, ) (1, ) (5,4) 1 3 input(X,Y)) Y = Y-Xinput(X) Y>0 Y0Y0 X>0 output(X,Y) X0X Y>0 Y0Y0

Identifying DU-Pairs – Variable X du-pairpath(s) (1,4) (1,7) (1, ) (1, ) (5,4) 1 3 input(X,Y)) Y := Y-Xinput(X) Y>0 Y0Y0 X>0 output(X,Y) X0X Y>0 Y0Y0

Identifying DU-Pairs – Variable X du-pairpath(s) (1,4) (1,7) (1, ) (1, ) (5,4) 1 3 input( X,Y)) Y := Y-Xinput(X) Y>0 Y0Y0 X >0 output(X,Y) X0X Y>0 Y0Y0

Identifying DU-Pairs – Variable X du-pairpath(s) (1,4) (1,7) (1, ) (1, ) (5,4) 1 3 input( X,Y)) Y := Y-Xinput(X) Y>0 Y0Y0 X >0 output(X,Y) X0X Y>0 Y0Y0

Identifying DU-Pairs – Variable X du-pairpath(s) (1,4) (1,7) (1, ) (1, ) (5,4) 1 3 input( X,Y)) Y := Y-Xinput(X) Y>0 Y0Y0 X >0 output(X,Y) X0X Y>0 Y0Y0

Identifying DU-Pairs – Variable X du-pairpath(s) (1,4) (1,7) (1, ) (1, ) (5,4) 1 3 input( X,Y)) Y = Y-Xinput(X) Y>0 Y0Y0 X>0 output(X,Y) X0X Y>0 Y0Y0

Identifying DU-Pairs – Variable X du-pairpath(s) (1,4) (1,7) (1, ) (1, ) (5,4) 1 3 input(X,Y)) Y := Y- X input( X ) Y>0 Y0Y0 X>0 output(X,Y) X0X Y>0 Y0Y0

Identifying DU-Pairs – Variable X du-pairpath(s) (1,4) (1,7) (1, ) (1, ) (5,4) 1 3 input(X,Y)) Y := Y- X input( X ) Y>0 Y0Y0 X>0 output(X,Y) X0X Y>0 Y0Y0

Identifying DU-Pairs – Variable X du-pairpath(s) (1,4) (1,7) (1, ) (1, ) (5,4) 1 3 input(X,Y)) Y := Y- X input( X ) Y>0 Y0Y0 X>0 output(X,Y) X0X Y>0 Y0Y0

Identifying DU-Pairs – Variable X du-pairpath(s) (5,7) (5, ) (5, ) 1 3 input(X,Y)) Y := Y-Xinput(X) Y>0 Y0Y0 X>0 output(X,Y) X0X Y>0 Y0Y0

Identifying DU-Pairs – Variable X du-pairpath(s) (5,7) † (5, ) (5, ) † infeasible 1 3 input(X,Y)) Y := Y-X input( X ) Y>0 Y0Y0 X>0 output( X,Y) X0X Y>0 Y0Y0

Identifying DU-Pairs – Variable X du-pairpath(s) (5,7) † (5, ) (5, ) † infeasible 1 3 input(X,Y)) Y := Y-X input( X ) Y>0 Y0Y0 X>0 output( X,Y) X0X Y>0 Y0Y0

Identifying DU-Pairs – Variable X du-pairpath(s) (5,7) † (5, ) (5, ) † infeasible 1 3 input(X,Y)) Y := Y-X input( X ) Y>0 Y0Y0 X>0 output( X,Y) X0X Y>0 Y0Y0

Identifying DU-Pairs – Variable X du-pairpath(s) (5,7) † (5, ) (5, ) † infeasible 1 3 input(X,Y)) Y := Y-X input( X ) Y>0 Y0Y0 X>0 output( X,Y) X0X Y>0 Y0Y0

Identifying DU-Pairs – Variable X du-pairpath(s) (5,7) † (5, ) (5, ) † infeasible 1 3 input(X,Y)) Y := Y-X input( X ) Y>0 Y0Y0 X>0 output( X,Y) X0X Y>0 Y0Y0

Identifying DU-Pairs – Variable X du-pairpath(s) (5,7) † (5, ) (5, ) † infeasible 1 3 input(X,Y)) Y := Y-X input( X ) Y>0 Y0Y0 X >0 output(X,Y) X0X Y>0 Y0Y0

Identifying DU-Pairs – Variable X du-pairpath(s) (5,7) † (5, ) (5, ) † infeasible 1 3 input(X,Y)) Y := Y-X input( X ) Y>0 Y0Y0 X >0 output(X,Y) X0X Y>0 Y0Y0

Identifying DU-Pairs – Variable X du-pairpath(s) (5,7) † (5, ) (5, ) † infeasible 1 3 input(X,Y)) Y := Y-X input( X ) Y>0 Y0Y0 X>0 output(X,Y) X0X Y>0 Y0Y0

Identifying DU-Pairs – Variable X du-pairpath(s) (5,7) † (5, ) (5, ) † † infeasible 1 3 input(X,Y)) Y := Y-X input( X ) Y>0 Y0Y0 X>0 output(X,Y) X0X Y>0 Y0Y0

Identifying DU-Pairs – Variable X du-pairpath(s) (5,7) † (5, ) (5, ) † † infeasible 1 3 input(X,Y)) Y := Y-X input( X ) Y>0 Y0Y0 X>0 output(X,Y) X0X Y>0 Y0Y0

More Dataflow Terms and Definitions A path (either partial or complete) is simple if all edges within the path are distinct ie different A path is loop-free if all nodes within the path are distinct ie different

Simple and Loop-Free Paths pathSimple?Loop-free?

More Dataflow Terms and Definitions A path is a du-path with respect to a variable v if v is defined at node n1 and either: 1.there is a c-use of v at node nk and is a def-clear simple path, or 2.there is a p-use of v at edge and is a def-clear loop- free path.

More Dataflow Terms and Definitions A path is a du-path with respect to a variable v if v is defined at node n1 and either: 1.there is a c-use of v at node nk and is a def-clear simple path, or 2.there is a p-use of v at edge and is a def-clear loop- free path. NOTE!

Identifying du-paths du-pairpath(s)du-path? X: (5,7) † X: (5, ) X: (5, ) † † infeasible

Another Dataflow Test Coverage Criterion All-DU-Paths: for every program variable v, every du-path from every definition of v to every c-use and every p-use of v must be covered

Exercise Identify all c-uses and p-uses for variable Y in Example 2 For each c-use or p-use, identify (using the “ * ” notation) all def-clear paths Identify whether or not each def-clear path is feasible, and whether or not it is a du-path

White-Box Coverage Subsumption Relationships Path All du- paths All-Uses All-Defs Compound Condition Branch / Condition Basis PathsLoop Condition Statement Branch