Data Flow Testing (DFT) Data flow testing is NOT the same as constructing Design Diagrams in the form of data-flow-diagrams (DFD) or E-R diagrams. It is.

Slides:



Advertisements
Similar presentations
Chapter 14 Software Testing Techniques - Testing fundamentals - White-box testing - Black-box testing - Object-oriented testing methods (Source: Pressman,
Advertisements

DATAFLOW TESTING DONE BY A.PRIYA, 08CSEE17, II- M.s.c [C.S].
Chapter 9 Code optimization Section 0 overview 1.Position of code optimizer 2.Purpose of code optimizer to get better efficiency –Run faster –Take less.
White Box and Black Box Testing Tor Stålhane. What is White Box testing White box testing is testing where we use the info available from the code of.
Course Outline Traditional Static Program Analysis –Theory Compiler Optimizations; Control Flow Graphs Data-flow Analysis – today’s class –Classic analyses.
Making Choices in C if/else statement logical operators break and continue statements switch statement the conditional operator.
1 Introduction to Data Flow Analysis. 2 Data Flow Analysis Construct representations for the structure of flow-of-data of programs based on the structure.
SOFTWARE TESTING. INTRODUCTION  Software Testing is the process of executing a program or system with the intent of finding errors.  It involves any.
Program Slice Program slice was a concept first discussed by Mark Weiser in the early 1980’s –He especially noticed that when people debug, they trace.
Describing Process Specifications and Structured Decisions Systems Analysis and Design, 7e Kendall & Kendall 9 © 2008 Pearson Prentice Hall.
 Control structures  Algorithm & flowchart  If statements  While statements.
1 CS 201 Compiler Construction Lecture 7 Code Optimizations: Partial Redundancy Elimination.
ITEC113 Algorithms and Programming Techniques
Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall Process Specifications and Structured Decisions Systems Analysis and Design, 8e Kendall.
1 “White box” or “glass box” tests “White Box” (or “Glass Box”) Tests.
1 CS 201 Compiler Construction Lecture 3 Data Flow Analysis.
Handouts Software Testing and Quality Assurance Theory and Practice Chapter 5 Data Flow Testing
Path testing Path testing is a “design structural testing” in that it is based on detailed design & the source code of the program to be tested. The methodology.
Topics in Software Dynamic White-box Testing: Data-flow Testing
CC0002NI – Computer Programming Computer Programming Er. Saroj Sharan Regmi Week 7.
1 ECE 453 – CS 447 – SE 465 Software Testing & Quality Assurance Instructor Kostas Kontogiannis.
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.
Data-Flow Analysis. Approaches Static Analysis Inspections Dependence analysis Symbolic execution Software Verification Data flow analysis Concurrency.
Path selection criteria Tor Stålhane & ‘Wande Daramola.
Software testing techniques Testing criteria based on data flow
Presented By Dr. Shazzad Hosain Asst. Prof., EECS, NSU
Software Testing (Part 2)
Copyright 2001 Oxford Consulting, Ltd1 January Storage Classes, Scope and Linkage Overview Focus is on the structure of a C++ program with –Multiple.
White-Box Testing Techniques II Originals prepared by Stephen M. Thebaut, Ph.D. University of Florida Dataflow Testing.
Describing Process Specifications and Structured Decisions Systems Analysis and Design, 7e Kendall & Kendall 9 © 2008 Pearson Prentice Hall.
Testing and Debugging Version 1.0. All kinds of things can go wrong when you are developing a program. The compiler discovers syntax errors in your code.
Mr. Dave Clausen1 La Cañada High School Chapter 6: Repetition Statements.
C++ Programming Language Lecture 2 Problem Analysis and Solution Representation By Ghada Al-Mashaqbeh The Hashemite University Computer Engineering Department.
Test Coverage CS-300 Fall 2005 Supreeth Venkataraman.
Coverage Estimating the quality of a test suite. 2 Code Coverage A code coverage model calls out the parts of an implementation that must be exercised.
Visual Basic Programming
Algorithm Design.
Theory and Practice of Software Testing
Think Possibility 1 Iterative Constructs ITERATION / LOOPS C provides three loop structures: the for-loop, the while-loop, and the do-while-loop. Each.
The Hashemite University Computer Engineering Department
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.
Path selection criteria Tor Stålhane & Wande Daramola.
Controlling Program Flow with Decision Structures.
1 Test Coverage Coverage can be based on: –source code –object code –model –control flow graph –(extended) finite state machines –data flow graph –requirements.
Fourth Quarter.  Involves loops or cycles ◦ Loops: means that a process may be repeated as long as certain condition remains true or remains false. ◦
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Extended Prelude to Programming Concepts & Design, 3/e by Stewart Venit and.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Extended Prelude to Programming Concepts & Design, 3/e by Stewart Venit and.
Copyright © 2011 Pearson Education Process Specifications and Structured Decisions Systems Analysis and Design, 8e Kendall & Kendall Global Edition 9.
CS Class 04 Topics  Selection statement – IF  Expressions  More practice writing simple C++ programs Announcements  Read pages for next.
Software Dynamic White-box Testing Part 2: Data-flow Testing Lecture 7 Prof. Mostafa Abdel Aziem Mostafa.
OPERATORS IN C CHAPTER 3. Expressions can be built up from literals, variables and operators. The operators define how the variables and literals in the.
SOFTWARE TESTING LECTURE 9. OBSERVATIONS ABOUT TESTING “ Testing is the process of executing a program with the intention of finding errors. ” – Myers.
Software Testing and QA Theory and Practice (Chapter 5: Data Flow Testing) © Naik & Tripathy 1 Software Testing and Quality Assurance Theory and Practice.
PREPARED BY G.VIJAYA KUMAR ASST.PROFESSOR
A Simple Syntax-Directed Translator
Data Structures and Algorithms
Some Simple Definitions for Testing
Structural testing, Path Testing
“White box” or “glass box” tests
Chapter 6 Intermediate-Code Generation
Structured Program
Programming Fundamentals (750113) Ch1. Problem Solving
White-Box Testing Techniques I
Control Structure Testing
Examining Variables on Flow Paths
White-Box Testing Techniques II
Software Testing and QA Theory and Practice (Chapter 5: Data Flow Testing) © Naik & Tripathy 1 Software Testing and Quality Assurance Theory and Practice.
Unit III – Chapter 3 Path Testing.
Presentation transcript:

Data Flow Testing (DFT) Data flow testing is NOT the same as constructing Design Diagrams in the form of data-flow-diagrams (DFD) or E-R diagrams. It is a form of structural testing and mostly White Box testing technique that focuses on program variables and the data paths: – From the point where a variable, v, is defined or assigned a value – To the point where that variable, v, is used Remember, to generate the path for testing we need to set up the data to drive the path.

Static Analysis of Data Static analysis allows us to check (test or find faults) without running the actual code, and we can apply it to analyzing variables as follows: 1.A data item(variable) that is defined but never used 2.A data item that is used but never defined 3.A data item that is defined a multiple times prior to usage. While these are dangerous signs, they may or may not lead to defects. 1.A defined, but never used variable may just be extra stuff 2.Some compilers will assign an initial value of zero or blank to all undefined variable based on the data type. 3.Multiple definitions prior to usage may just be bad and wasteful logic We are more interested in “executing” the code than just static analysis, though.

Data Dependencies and Data Flow Testing(DFT) In Data Flow Testing (DFT) we are interested in the “dependencies” among data or “relationships” among data Consider a data item, X: – Data Definitions (value assignment) of X: via 1) initialization, 2) input, or 3) some assignment. Integer X; (compiler initializes X to 0 or it will be “trash”) X = 3; Input X; – Data Usage (accessing the value) of X: for 1) computation and assignment (C-Use) or 2) for decision making in a predicate (P- Use) Z = X + 25; (C-Use) If ( X > 0 ) then (P-Use)

Data “Dependencies” or Data “Relationships” There are basically 4 possible combinations of “relationships” between data Definition (D) and data Usage (U). For example for a data item, X: 1.D-U : relationship between X defined and X used afterwards (**this is the main relationship of concern for Data Flow Testing). 2.D–D: relationship between X is defined and is redefined with no usage in between ( a case of potential error or in multiple & parallel paths execution of a potential race condition) 3.U-D: relationship between X is used first and then defined afterward ( a case of potential error) 4.U-U: relationship between X being used and used again later (there is no impact to X and thus not considered for testing)

Main Steps in Data Flow Testing The main steps in Data Flow Testing are: 1.Build and Verify the Data Dependency Graph (DDG) 2.Define and select the data slice of interest to cover for developing the test case 3. Develop the test case by selecting/deciding on what input values to use (the key to DFT) 4.Execute the test case and analyze the result.

A simple Data Dependency Graph(DDG) Instead of control flow as in execution paths, we use the data and depict the “flow of data” or “relation among data” Example: integer x, y, z; input x, y; z = y + x; xy z - The nodes (circle) represent data items. - The links (arrow) represent the flow of x and y to z or dependency of z on x and y

Characterizing Data Dependency Graph(DDG) We are mostly interested in D-U relationship when performing DFT: – Each node in a Data Dependency Graph (DDG) represents, a data item, x and the nodes may be classified in 3 ways: Output or result node of some computation or assignment. This node will most likely express x in terms of (linked-from) some other node. Input or constant node that represents x as the user provided input or a pre-defined constant. It usually links-to some other node Intermediate or storage node where x is neither an input or output; x is most likely an intermediate storage (C-Use) to facilitate some computation. It usually will both link-from some other node and link-to some other node. – The relation modeled is D-U, and the linkage arrow from x to z depicts x “is used by” z.

Data Used in Predicate Node for (P-Use) Data used for P-use is depicted a little differently: - consider a “segment”: input w; if w ≥ 3 then z = x; else z = y; x y zw≥3w≥3 3w w≥3 / w<3 w≥3 w<3 -Note that data item, w, is used mainly for P-use. -Note that constant 3 is also used for P-use. -The dotted arrow depicts the relation of P-use

Generating inputs to Drive the Data FlowTest The basic concept in DFT is to design test cases (with the appropriate inputs) to cover the D-U relationships in the DDG: – C-use – P-use x y zw≥3w≥3 3w w≥3 / w<3 w≥3 w<3 1) We need to design test cases with data items ‘x’ and ‘y’ “defined” for C-use and different values of data item ‘w’ defined for P-use. 2) Then display ‘z‘ for the test result analysis.

Generic Procedure for DDG Construction 1.Indentify the output or result data items of interest 2.Backward chain to resolve (trace) these data items using other data items (both variables and constants)by consulting the source (program, pseudo code, specification). – This backward chain is often called a “slice” ---- a “data slice” 3.If there is any unresolved data item during the trace, then for that unresolved variable repeat the above steps 1 and 2. Perform this until there is no unresolved data item left. Note - i) with this construction mechanism all the “leaf” nodes at the “top“ of a DDG must be an “input/assignment” data item node or a “constant” data item node - ii) that we may need to stepwise construct several DDG’s for a complete specification - iii) that if we have a node that is disconnected to any DDG’s or nodes, then that is likely a “dead node” which is extraneous and potentially an error

An “awkward” Data Dependency Graph Example Pseudo code example 1. int limit = 10; 2. input y ; 3. input x ; 4. for (int i = 1; i < limit ; i++) 5. { x = x + i; 6. y = y + i 2 ; } 7. print (“ x = “, x, “y =“, y); 10 1 limit i i++ i < limit i 2 yx y + i 2 x + i print y print x Note the “awkwardness” of DDG when there is a loop

A “awkward” Data Dependency Graph Example Pseudo code example 1. int limit = 10; 2. input y ; 3. input x ; 4. for (int i = 1; i < limit ; i++) 5. { x = x + i; 6. y = y + i 2 ; } 7. print (“ x = “, x, “y =“, y); 10 1 limit i i++ i < limit i 2 yx y + i 2 x + i print y print x Note the “awkwardness” of DDG when there is a loop ; also look at “i++” more carefully-----

Picking up a “data slice” related to “print y” Pseudo code example 1. int limit = 10; 2. input y ; 3. input x ; 4. for (int i = 0; i < limit ; i++) 5. { x = x + i; 6. y = y + i 2 ; } 7. print (“ x = “, x, “y =“, y); 10 1 limit i i++ i < limit i 2 yx y + i 2 x + i print y print x Using the DDG to follow the D-U paths in a data slice.

Picking up a “slice” related to “print y” Pseudo code example 1. int limit = 10; 2. input y ; 3. input x ; 4. for (int i = 1; i < limit ; i++) 5. { x = x + i; 6. y = y + i 2 ; } 7. print (“ x = “, x, “y =“, y); limit = 10 Input y Input x i = 1 x = x + i y = y +i 2 i = i + 1 i < limit print y print x ** Some finds the “control flow” a little easier to follow than the “data dependency” when we are looking at D-U “paths” of data.