Graph Coverage for Source Code. Data Flow Graph Coverage for Source Code

Size: px
Start display at page:

Download "Graph Coverage for Source Code. Data Flow Graph Coverage for Source Code"

Transcription

1 Graph Coverage for Source Code Data Flow Graph Coverage for Source Code 1

2 Graph Coverage for Design Elements Use of data abstraction and object oriented software has increased importance on modularity and reuse. Therefore testing of software based design (design elements) is more important that past They are usually associated with integration testing. Since modularity, the software components can be tested independently. 2

3 DU Pair Data flow testing criteria use the fact that values are carried from defs to uses. We call these du-pairs They are also known as definition-use, def-use, and du associations in the testing literature The idea of data flow criteria is to exercise du-pairs in various If a def and a use appear on the same node, then it is only a DU-pair if the def occurs after the use and the node is in a loop 3

4 def clear & all uses Definitions A definition d for a variable x reaches a use u if there is a path from d to u that has no other definitions of x (def-clear). The all-uses (AU) criterion requires tests to tour at least one subpath from each definition to each reachable use.

5 // EXAMPLE: return index of the last element in x that equals y. // if y is not in x, return -1. public int findlast (int []x, int y) { for (int i = x.length-1; i>=0; i--) { if (x[i] == y) return i; } return -1; use 3=( def(5) = { i} use (5) = { i} 5

6 Annotated Control Graph Nodes 4 and 6 are final nodes, corresponding to the return statements. Node 2 is introduced to capture the for loop; it has no executable statements. DU (def-use) pairs are shown as a variable name followed by the def node, then the use node. use(3)= def(5) = { i} use (5) = { i} Def -Use Pairs = { (1, 1,x), (1,3,x), (1,3,y), (1, 2,i), (1, 3,i), (1,5,i), (1,6,i), (5, 2,i), (5, 3,i), ( 5, 6,i), (5, 5,i)}

7 Another for Example Control Flow Graph using the function ComputeStats 7

8 public static void computestats (int [ ] numbers) { int length = numbers.length; double med, var, sd, mean, sum, varsum; sum = 0; for (int i = 0; i < length; i++) { sum += numbers [ i ]; } med = numbers [ length / 2]; mean = sum / (double) length; varsum = 0; for (inti= 0; i< length; i++) { varsum = varsum + ((numbers [ I ] - mean) * (numbers [ I ] - mean)); } var = varsum / ( length ); sd = Math.sqrt ( var ); i = 0 i = 0 System.out.println ("length: " + length); i < length System.out.println ("mean: " + mean); i >= length System.out.println ("median: " + med); System.out.println ("variance: " + var); 7 8 System.out.println ("standard deviation: " + sd); } i

9 Control Flow Graph for the function ComputeStats 1 ( numbers ) sum = 0 length = numbers.length 2 i = 0 3 i >= length 4 i < length sum += numbers [ i ] i med = numbers [ length / 2 ] mean = sum / (double) length varsum = 0 i = 0 i >= length varsum = i++ 7 i < length 8 var = varsum / ( length ) sd = Math.sqrt ( var ) print (length, mean, med, var, sd) 9

10 Control Flow Graph for the function with Defs & Uses 1 def (1) = { numbers, sum, length } use (1) = { numbers} 2 def (2) = { i } Turn the annotations into defand use sets 3 use (3, 4) = { i, length } use (3, 5) = { i, length } 4 def (4) = { sum, i } use (4) = { sum, numbers, i } def (7) = { varsum, i } use (7) = { varsum, numbers, i, mean } use (6, 7) = { i, length } def (5) = { med, mean, varsum, i } use (5) = { numbers, length, sum } use (6, 8) = { i, length } 8 def (8) = { var, sd } use (8) = { varsum, length, mean, med, var, sd } Ammann & Offutt 10

11 Defs and Uses Tables for the function Node Def Use 1 { numbers, sum, length } 2 { i } 3 { numbers } 4 { sum, i } { numbers, i, sum } 5 { med, mean, varsum, i } 6 { numbers, length, sum } 7 { varsum, i } { varsum, numbers, i, mean } 8 { var, sd } { varsum, length, var, mean, med, var, sd } Edge (1, 2) (2, 3) Use (3, 4) { i, length } (4, 3) (3, 5) { i, length } (5, 6) (6, 7) { i, length } (7, 6) (6, 8) { i, length } 11

12 DU Pairs for the function variable numbers (1, 4) (1, 5) (1, 7) DU Pairs length (1, 5) (1, 8) (1, (3,4)) (1, (3,5)) (1, (6,7)) (1, (6,8)) med (5, 8) var (8, 8) sd (8, 8) mean (5, 7) (5, 8) sum (1, 4) (1, 5) (4, 4) (4, 5) varsum (5, 7) (5, 8) (7, 7) (7, 8) i (2, 4) (2, (3,4)) (2, (3,5)) (2, 7) (2, (6,7)) (2, (6,8)) (4, 4) (4, (3,4)) (4, (3,5)) (4, 7) (4, (6,7)) (4, (6,8)) (5, 7) (5, (6,7)) (5, (6,8)) (7, 7) (7, (6,7)) (7, (6,8)) Defs come before uses, do not count as DU pairs defs after use in loop, these are valid DU pairs No def-clear path different scope for i No path through graph from nodes 5 and 7 to 4 or 3 12

13 DU Paths for the Function variable DU Pairs DU Paths numbers (1, 4) (1, 5) (1, 7) length (1, 5) (1, 8) (1, (3,4)) (1, (3,5)) (1, (6,7)) (1, (6,8)) [ 1, 2, 3, 4 ] [ 1, 2, 3, 5 ] [ 1, 2, 3, 5, 6, 7 ] [ 1, 2, 3, 5 ] [ 1, 2, 3, 5, 6, 8 ] [ 1, 2, 3, 4 ] [ 1, 2, 3, 5 ] [ 1, 2, 3, 5, 6, 7 ] [ 1, 2, 3, 5, 6, 8 ] med (5, 8) [ 5, 6, 8 ] var (8, 8) No path needed sd (8, 8) No path needed sum (1, 4) (1, 5) (4, 4) (4, 5) [ 1, 2, 3, 4 ] [ 1, 2, 3, 5 ] [ 4, 3, 4 ] [ 4, 3, 5 ] variable DU Pairs DU Paths mean (5, 7) (5, 8) varsum (5, 7) (5, 8) (7, 7) (7, 8) i (2, 4) (2, (3,4)) (2, (3,5)) (4, 4) (4, (3,4)) (4, (3,5)) (5, 7) (5, (6,7)) (5, (6,8)) (7, 7) (7, (6,7)) (7, (6,8)) [ 5, 6, 7 ] [ 5, 6, 8 ] [ 5, 6, 7 ] [ 5, 6, 8 ] [ 7, 6, 7 ] [ 7, 6, 8 ] [ 2, 3, 4 ] [ 2, 3, 4 ] [ 2, 3, 5 ] [ 4, 3, 4 ] [ 4, 3, 4 ] [ 4, 3, 5 ] [ 5, 6, 7 ] [ 5, 6, 7 ] [ 5, 6, 8 ] [ 7, 6, 7 ] [ 7, 6, 7 ] [ 7, 6, 8 ] 13

14 DU Paths for the function No Duplicates There are 38 DU paths for the function, but only 12 unique [ 1, 2, 3, 4 ] [ 1, 2, 3, 5 ] [ 1, 2, 3, 5, 6, 7 ] [ 1, 2, 3, 5, 6, 8 ] [ 2, 3, 4 ] [ 2, 3, 5 ] [ 4, 3, 4 ] [ 4, 3, 5 ] [ 5, 6, 7 ] [ 5, 6, 8 ] [ 7, 6, 7 ] [ 7, 6, 8 ] 4 expect a loop not to be entered 6 require at least one iteration of a loop 2 require at least two iterations of a loop 14

15 Graph Coverage for Design Elements Structural Graph Coverage for Design Elements 15

16 Structural Graph Coverage for Design Elements Use of data abstraction and object oriented software has increased importance on modularity and reuse. Therefore testing of software based design (design elements) is more important that past They are usually associated with integration testing. Since modularity, the software components can be tested independently. 16

17 Data Flow Coverage at the Design Level Data flow couplings among units and classes are more complicated than control flow couplings When values are passed, they change names Many different ways to share data Finding defs and uses can be difficult finding which uses a def can reach is very difficult When software gets complicated testers should get interested That s where the faults are! Caller : A unit that invokes another unit Callee : The unit that is called Callsite : Statement or node where the call appears Actual parameter : Variable in the caller Formal parameter : Variable in the callee 17

18 Data Flow Graph Coverage for Design Elements This technique can be limited to the unit interfaces Data flow is concerned only with last-defs before calls and returns and first-uses after calls and returns. The last-defs before a call are locations with defs that reach uses at callsites The last-defs before a return are locations with defs that reach a return statement. 18

19 Data Flow Graph Coverage for Design Finally Elements All-du-Paths coverage requires that we tour every simple path from every last-def to every first-use. As before, the All-du-Paths criterion can be satisfied by tours that include sidetrips. All-du-Paths is also called All-Coupling-du-Paths coverage. 19

20 Example Call Site void Main() M B (x) interface M end Main B (Y) M end B Callee Caller Actual Parameter Formal Parameter Applying data flow criteria to def-use pairs between units is too expensive This technique is limited to the unit interface Too many possibilities But this is integration testing, and we really only care about the interface 20

21 Data-Bound Relationships Between Design Elements Caller: unit that invokes the callee An actual parameter (value passed to the callee by the caller; ) is in the caller Its value is assigned to a formal parameter in the callee. 21

22 Coupling Three different ways that different program parts might interact: Parameter Coupling: relationships between caller and callees; passing data as parameters; Shared Data Coupling: one unit writes to some in-memory data, another unit reads this data; External Data Coupling: one unit writes data e.g. to disk, another read reads the data. 22

23 Parameter Coupling 23

24 def-use pairs as Normal Coupling Data Flow Analysis I def use A () intra-procedural data flow (within the same unit) The method A() contains def and use. Here the variable is omitted It is assumed that all du pairs refer to the same variable. This is classic Data Flow Coverage for design elements 24

25 def-use pairs as Normal Coupling Data Flow Analysis II All du pairs between a caller A() and a callee B() This example is another classic Data Flow Coverage for design elements 25

26 Coupling Data-flow We are only testing variables that have a definition on one side and a use on the otherside we do not impose test requirements in the following case: 26

27 Inter-procedural DU Pairs If we focus on the interface, then we just need to consider the last definitions of variables before calls and returns and first uses inside units and after calls Last-def : The set of nodes that define a variable x and has a def-clear path from the node through a call site to a use in the other unit Can be from caller to callee (parameter or shared variable) or from callee to caller as a return value First-use : The set of nodes that have uses of a variable y and for which there is a def-clear and use-clear path from the call site to the nodes 27

28 du-pairs between Callers and Callees The last-defs are 2, 3 The first-uses are 12, 13 28

29 Inter-procedural DU pairs last-def & first-use The last-def is the definition that goes through the call or return Can be from caller to callee (parameter or shared variable) or from callee to caller as a return value The first-use picks up that definition. 29

30 Coupling DU -Pairs 30

31 Caller Inter-procedural DU Pairs F x = 14 M y = G (x) DU pair M print (y) last-def callsite first-use 1 2 x = 5 x = 4 3 x = Z = y Last Defs 2, 3 First Uses 11, 12 B (int y) 12 T = y Callee G(a) DU pair print (a) M b = 42 M return (b) first-use last-def Coupling du-pairs The callsite has two du-pairs. o x in F() is passed to a in G() o b in G() is returned andassigned to y in F(). 4 B (x) 13 print (y) last-defs and first -uses o The unit on the left, the caller calles the callee B, with one actual parameter x, which is assigned to formal parameter y. o x is defined at nodes 1,2,3, but def at node 1 cannot reach the callsite at node 4, thus last-defs for x is the set {2,3}. o The formal parameter y is used at nodes 11,12,13, but use-clear path goes from the entry point at node 10 to 13, so the first-uses for y is the set {11,12}. 31

Introduction to Software Testing Chapter 2.3 Graph Coverage for Source Code. Paul Ammann & Jeff Offutt

Introduction to Software Testing Chapter 2.3 Graph Coverage for Source Code. Paul Ammann & Jeff Offutt Introduction to Software Testing Chapter 2.3 Graph Coverage for Source Code Paul Ammann & Jeff Offutt Overview The most common application of graph criteria is to program source Graph : Usually the control

More information

Overview Graph Coverage Criteria

Overview Graph Coverage Criteria Overview Graph Coverage Criteria Graph Coverage Four Structures for Modeling Software Graphs Logic Input Space Syntax Applied to Applied to Source FSMs Applied to Specs DNF Source Specs Source Models Design

More information

Introduction to Software Testing Chapter 2.4 Graph Coverage for Design Elements Paul Ammann & Jeff Offutt

Introduction to Software Testing Chapter 2.4 Graph Coverage for Design Elements Paul Ammann & Jeff Offutt Introduction to Software Testing Chapter 2.4 Graph Coverage for Design Elements Paul Ammann & Jeff Offutt www.introsoftwaretesting.com OO Software and Designs Emphasis on modularity and reuse puts complexity

More information

Introduc)on to So,ware Tes)ng (2nd edi(on) Overview Graph Coverage Criteria. Paul Ammann & Jeff OffuA. hap:// so,waretest/

Introduc)on to So,ware Tes)ng (2nd edi(on) Overview Graph Coverage Criteria. Paul Ammann & Jeff OffuA. hap://  so,waretest/ Tes)ng (2nd edi(on) Overview Graph Coverage Criteria Paul Ammann & Jeff OffuA hap://www.cs.gmu.edu/~offua/ so,waretest/ First version, 23 September 2013 Graph Coverage Four Structures for Modeling Software

More information

Testing Object Oriented Software 2010

Testing Object Oriented Software 2010 Testing Object Oriented Software 2010 Graph Coverage Barry van Veen Rick van der Zwet 2.1 Graph coverage Introduction into graph coverage Theoretical definition of

More information

Introduction to Software Testing Chapter 2, Sections: 2.1 & 2.2 Overview Graph Coverage Criteria

Introduction to Software Testing Chapter 2, Sections: 2.1 & 2.2 Overview Graph Coverage Criteria Introduction to Software Testing Chapter 2, Sections: 2.1 & 2.2 Overview Graph Coverage Criteria Paul Ammann & Jeff Offutt http://www.cs.gmu.edu/~offutt/softwa retest/ Ch. 2 : Graph Coverage Four Structures

More information

Introduction to Software Testing Chapter 2.1, 2.2 Overview Graph Coverage Criteria Paul Ammann & Jeff Offutt

Introduction to Software Testing Chapter 2.1, 2.2 Overview Graph Coverage Criteria Paul Ammann & Jeff Offutt Introduction to Software Testing Chapter 2.1, 2.2 Overview Graph Coverage Criteria Paul Ammann & Jeff Offutt www.introsoftwaretesting.com Ch. 2 : Graph Coverage Four Structures for Modeling Software Graphs

More information

Defining Functions. Chapter 6. Wednesday, January 23, Why functions?

Defining Functions. Chapter 6. Wednesday, January 23, Why functions? Defining Functions Chapter 6 1 Why functions? Functions allow decomposition of programs into manageable, reusable, components Functions are similar to mathematical functions, but also differ: parameter

More information

Introduction to Software Testing Chapter 3, Sec# 3.3 Logic Coverage for Source Code

Introduction to Software Testing Chapter 3, Sec# 3.3 Logic Coverage for Source Code Introduction to Software Testing Chapter 3, Sec# 3.3 Logic Coverage for Source Code Paul Ammann & Jeff Offutt http://www.cs.gmu.edu/~offutt/soft waretest/ Logic Expressions from Source Predicates are derived

More information

Introduction to Software Testing Chapter 2, Sec#: 2.5 Graph Coverage for Specifications

Introduction to Software Testing Chapter 2, Sec#: 2.5 Graph Coverage for Specifications Introduction to Software Testing Chapter 2, Sec#: 2.5 Graph Coverage for Specifications Paul Ammann & Jeff Offutt http://www.cs.gmu.edu/~offutt/softwa retest/ Design Specifications A design specification

More information

COMP 3705 Advanced Software Engineering: Software Testing

COMP 3705 Advanced Software Engineering: Software Testing COMP 3705 Advanced Software Engineering: Software Testing Prof. Matt Rutherford For Next Week Readings For Midterm: Chapter 1 and Sections 2.1-2.6, 3.1 3.5 New material: Chapter 4 Homework #5 http://mjrutherford.org/teaching/2009/winter/comp3705/homeworks

More information

Class Analysis for Testing of Polymorphism in Java Software

Class Analysis for Testing of Polymorphism in Java Software Class Analysis for Testing of Polymorphism in Java Software Atanas Rountev Ana Milanova Barbara G. Ryder Rutgers University, New Brunswick, NJ 08903, USA {rountev,milanova,ryder@cs.rutgers.edu Abstract

More information

CMPT 473 Software Quality Assurance. Graph Coverage. Nick Sumner

CMPT 473 Software Quality Assurance. Graph Coverage. Nick Sumner CMPT 473 Software Quality Assurance Graph Coverage Nick Sumner Recall: Coverage/Adequacy Can't look at all possible inputs. Need to determine if a test suite covers / is adequate for our quality objectives.

More information

Introduction to Software Testing

Introduction to Software Testing Introduction to Software Testing Paul Ammann and Jeff Offutt Solutions to Exercises Student Version November 18, 2015 Copyright Ammann & Offutt, 2002-2009, all rights reserved. 2 Tell me and I may forget.

More information

Fault, Error, and Failure

Fault, Error, and Failure Fault, Error, and Failure Testing, Quality Assurance, and Maintenance Winter 2018 Prof. Arie Gurfinkel based on slides by Prof. Lin Tan and others Terminology, IEEE 610.12-1990 Fault -- often referred

More information

Program-based Mutation Testing

Program-based Mutation Testing Program-based Mutation Testing CS 4501 / 6501 Software Testing [Ammann and Offutt, Introduction to Software Testing, Ch. 9.2] 1 Applying Syntax-Based Testing to Programs Test requirements are derived from

More information

Logic Coverage for Source Code

Logic Coverage for Source Code Logic Coverage for Source Code CS 4501 / 6501 Software Testing [Ammann and Offutt, Introduction to Software Testing, Ch. 8] 1 Structural Logic Coverage for Source Code Aim: to identify test requirements

More information

Functions. printf( %f cubed is %f,x,cube(x)); return 0; } return parameter type double cube(double var) { return (var*var*var);

Functions. printf( %f cubed is %f,x,cube(x)); return 0; } return parameter type double cube(double var) { return (var*var*var); Functions chapter 3 of the text int main(void) double x,y,z; x = cube(y/3.0); printf( %f cubed is %f,x,cube(x)); return 0; return parameter type double cube(double var) return (var*var*var); main() is

More information

Criteria for Testing Polymorphic Relationships

Criteria for Testing Polymorphic Relationships Criteria for Testing Polymorphic Relationships Roger T. Alexander and A. Jefferson Offutt George Mason University Department of Information and Software Engineering Software Engineering Research Laboratory

More information

An Experimental Comparison of Four Unit Test Criteria: Mutation, Edge-Pair, All-uses and Prime Path Coverage

An Experimental Comparison of Four Unit Test Criteria: Mutation, Edge-Pair, All-uses and Prime Path Coverage An Experimental Comparison of Four Unit Test Criteria: Mutation, Edge-Pair, All-uses and Prime Path Coverage Nan Li, Upsorn Praphamontripong and Jeff Offutt Software Engineering George Mason University

More information

Faults, Errors, Failures

Faults, Errors, Failures Faults, Errors, Failures CS 4501 / 6501 Software Testing [Ammann and Offutt, Introduction to Software Testing ] 1 Software Testing Review Testing = process of finding input values to check against a software

More information

CS 161 Computer Security

CS 161 Computer Security Wagner Spring 2014 CS 161 Computer Security 1/27 Reasoning About Code Often functions make certain assumptions about their arguments, and it is the caller s responsibility to make sure those assumptions

More information

Testing Role in Unified Approach Coverage: Structural/Coverage Model Based Test Generation from Model Checking (project) Interaction of

Testing Role in Unified Approach Coverage: Structural/Coverage Model Based Test Generation from Model Checking (project) Interaction of Testing Role in Unified Approach Coverage: Structural/Coverage Model Based Test Generation from Model Checking (project) Interaction of Coverage/Model Based Testing Will Not Cover Statistical Methods Partition

More information

Integration Testing. Conrad Hughes School of Informatics. Slides thanks to Stuart Anderson

Integration Testing. Conrad Hughes School of Informatics. Slides thanks to Stuart Anderson Integration Testing Conrad Hughes School of Informatics Slides thanks to Stuart Anderson 19 February 2010 Software Testing: Lecture 10 1 Unit Test vs Integration Testing 1 The ideal in unit testing is

More information

Using the code to measure test adequacy (and derive test cases) Structural Testing

Using the code to measure test adequacy (and derive test cases) Structural Testing Using the code to measure test adequacy (and derive test cases) Structural Testing Objectives To describe a second approach to testing which is geared to find program defects To explain the use of program

More information

Integration Testing. Unit Test vs Integration Testing 1. Unit Testing vs Integration Testing 2. Unit testing: isolation, stub/mock objects

Integration Testing. Unit Test vs Integration Testing 1. Unit Testing vs Integration Testing 2. Unit testing: isolation, stub/mock objects Unit Test vs Testing 1 Testing Conrad Hughes School of Informatics Slides thanks to Stuart Anderson The ideal in unit testing is to isolate a single code unit and test it against its behavioural specification.

More information

No Source Code. EEC 521: Software Engineering. Specification-Based Testing. Advantages

No Source Code. EEC 521: Software Engineering. Specification-Based Testing. Advantages No Source Code : Software Testing Black-Box Testing Test-Driven Development No access to source code So test cases don t worry about structure Emphasis is only on ensuring that the contract is met Specification-Based

More information

Black Box Testing. EEC 521: Software Engineering. Specification-Based Testing. No Source Code. Software Testing

Black Box Testing. EEC 521: Software Engineering. Specification-Based Testing. No Source Code. Software Testing Black Box Testing EEC 521: Software Engineering Software Testing Black-Box Testing Test-Driven Development Also known as specification-based testing Tester has access only to running code and the specification

More information

CS1150 Principles of Computer Science Methods

CS1150 Principles of Computer Science Methods CS1150 Principles of Computer Science Methods Yanyan Zhuang Department of Computer Science http://www.cs.uccs.edu/~yzhuang CS1150 UC. Colorado Springs Opening Problem Find the sum of integers from 1 to

More information

Testing Object-Oriented Software. 22 November 2017

Testing Object-Oriented Software. 22 November 2017 Testing Object-Oriented Software 22 November 2017 Testing Object-Oriented Software 2 Problems in object-oriented testing [Binder] Each level in the class hierarchy creates a new context for inherited features:

More information

Lesson 36: for() Loops (W11D1)

Lesson 36: for() Loops (W11D1) Lesson 36: for() Loops (W11D1) Balboa High School Michael Ferraro October 26, 2015 1 / 27 Do Now Create a new project: Lesson36 Write class FirstForLoop: Include a main() method: public static void main(string[]

More information

An Eclipse Plug-in for Model Checking

An Eclipse Plug-in for Model Checking An Eclipse Plug-in for Model Checking Dirk Beyer, Thomas A. Henzinger, Ranjit Jhala Electrical Engineering and Computer Sciences University of California, Berkeley, USA Rupak Majumdar Computer Science

More information

New Concepts. Lab 7 Using Arrays, an Introduction

New Concepts. Lab 7 Using Arrays, an Introduction Lab 7 Using Arrays, an Introduction New Concepts Grading: This lab requires the use of the grading sheet for responses that must be checked by your instructor (marked as Question) AND the submission of

More information

Advanced Test Coverage Criteria: Specify and Measure, Cover and Unmask

Advanced Test Coverage Criteria: Specify and Measure, Cover and Unmask Advanced Test Coverage Criteria: Specify and Measure, Cover and Unmask Sébastien Bardin & Nikolai Kosmatov joint work with Omar Chebaro, Robin David, Mickaël Delahaye, Michaël Marcozzi, Mike Papadakis,

More information

Implementing Subprograms

Implementing Subprograms 1 Implementing Subprograms CS 315 Programming Languages Pinar Duygulu Bilkent University CS315 Programming Languages Pinar Duygulu The General Semantics of Calls and Returns 2 The subprogram call and return

More information

Introduction to Software Testing Chapter 3.1, 3.2 Logic Coverage Paul Ammann & Jeff Offutt

Introduction to Software Testing Chapter 3.1, 3.2 Logic Coverage Paul Ammann & Jeff Offutt Introduction to Software Testing Chapter 3.1, 3.2 Logic Coverage Paul Ammann & Jeff Offutt http://www.cs.gmu.edu/~offutt/softwaretest/ Ch. 3 : Logic Coverage Four Structures for Modeling Software Graphs

More information

Introduction to Software Testing Chapter 3.1, 3.2 Logic Coverage Paul Ammann & Jeff Offutt

Introduction to Software Testing Chapter 3.1, 3.2 Logic Coverage Paul Ammann & Jeff Offutt Introduction to Software Testing Chapter 3.1, 3.2 Logic Coverage Paul Ammann & Jeff Offutt www.introsoftwaretesting.com Ch. 3 : Logic Coverage Four Structures for Modeling Software Graphs Logic Input Space

More information

Introduction to Software Testing Chapter 3, Sec# 1 & 2 Logic Coverage

Introduction to Software Testing Chapter 3, Sec# 1 & 2 Logic Coverage Introduction to Software Testing Chapter 3, Sec# 1 & 2 Logic Coverage Paul Ammann & Jeff Offutt http://www.cs.gmu.edu/~offutt/soft waretest/ Ch. 3 : Logic Coverage Four Structures for Modeling Software

More information

Compilers. Cool Semantics II. Alex Aiken

Compilers. Cool Semantics II. Alex Aiken Compilers Informal semantics of new T Allocate locations to hold all attributes of an object of class T Essentially, allocate a new object Set attributes with their default values Evaluate the initializers

More information

COMP 3705 Advanced Software Engineering: Software Testing

COMP 3705 Advanced Software Engineering: Software Testing COMP 3705 Advanced Software Engineering: Software Testing Prof. Matt Rutherford Class 09-2009-03-02 (c) 2009 Matthew J. Rutherford For Next Week Readings Chapters 7 and 9 Homework #8 See website Class

More information

Program Structure. Simple Statements. Program consists of blocks Block. Can be represented by a flow graph. Sequence of statements

Program Structure. Simple Statements. Program consists of blocks Block. Can be represented by a flow graph. Sequence of statements An Applicable Family of Data Flow Testing Criteria Assumptions about the program No goto statements with variant records Functions having var parameters By reference Procedural or functional parameters

More information

Program Structure. Simple Statements. Program consists of blocks Block. Can be represented by a flow graph. Sequence of statements

Program Structure. Simple Statements. Program consists of blocks Block. Can be represented by a flow graph. Sequence of statements An Applicable Family of Data Flow Testing Criteria Assumptions about the program No goto statements with variant records Functions having var parameters By reference Procedural or functional parameters

More information

Lecture 5: Methods CS2301

Lecture 5: Methods CS2301 Lecture 5: Methods NADA ALZAHRANI CS2301 1 Opening Problem Find the sum of integers from 1 to 10, from 20 to 30, and from 35 to 45, respectively. 2 Solution public static int sum(int i1, int i2) { int

More information

Chapter 10. Implementing Subprograms ISBN

Chapter 10. Implementing Subprograms ISBN Chapter 10 Implementing Subprograms ISBN 0-321-33025-0 Chapter 10 Topics The General Semantics of Calls and Returns Implementing Simple Subprograms Implementing Subprograms with Stack-Dynamic Local Variables

More information

Combinatorial Clause Coverage CoC

Combinatorial Clause Coverage CoC Introduction to Software Testing Chapter 3.2 Logic Coverage Paul Ammann & Jeff Offutt Covering Logic Expressions Logic expressions show up in many situations Covering logic expressions is required by the

More information

Programming Exercise 7: Static Methods

Programming Exercise 7: Static Methods Programming Exercise 7: Static Methods Due date for section 001: Monday, February 29 by 10 am Due date for section 002: Wednesday, March 2 by 10 am Purpose: Introduction to writing methods and code re-use.

More information

Calvin Lin The University of Texas at Austin

Calvin Lin The University of Texas at Austin Interprocedural Analysis Last time Introduction to alias analysis Today Interprocedural analysis March 4, 2015 Interprocedural Analysis 1 Motivation Procedural abstraction Cornerstone of programming Introduces

More information

Siloed Reference Analysis

Siloed Reference Analysis Siloed Reference Analysis Xing Zhou 1. Objectives: Traditional compiler optimizations must be conservative for multithreaded programs in order to ensure correctness, since the global variables or memory

More information

Test Case Generation Based on Sequence Diagrams

Test Case Generation Based on Sequence Diagrams Test Case Generation Based on Sequence Diagrams Yao-Cheng Lei Nai-Wei Lin Department of Computer Science and Information Engineering National Chung Cheng University Chiayi, Taiwan 621, R.O.C. {lyc94,naiwei}@cs.ccu.edu.tw

More information

CMPSCI 521/621 Homework 2 Solutions

CMPSCI 521/621 Homework 2 Solutions CMPSCI 521/621 Homework 2 Solutions Problem 1 Direct data dependencies: 3 is directly data dependent on 1 and 5 5 is directly data dependent on 1,3, and 5 7 is directly data dependent on 1,3, and 5 Note,

More information

Programming Languages: Lecture 12

Programming Languages: Lecture 12 1 Programming Languages: Lecture 12 Chapter 10: Implementing Subprograms Jinwoo Kim jwkim@jjay.cuny.edu Chapter 10 Topics 2 The General Semantics of Calls and Returns Implementing Simple Subprograms Implementing

More information

Chapter 14 Testing Tactics

Chapter 14 Testing Tactics Chapter 14 Testing Tactics Moonzoo Kim CS Division of EECS Dept. KAIST moonzoo@cs.kaist.ac.kr http://pswlab.kaist.ac.kr/courses/cs550-07 Spring 2007 1 Overview of Ch14. Testing Tactics 14.1 Software Testing

More information

Data Structures. Subodh Kumar. Dept of Computer Sc. & Engg. IIT Delhi

Data Structures. Subodh Kumar. Dept of Computer Sc. & Engg. IIT Delhi Data Structures Subodh Kumar Dept of Computer Sc. & Engg. IIT Delhi OOP Quiz 2 Class Bird extends class Animal. class Cat { public Bird catchbird(bird birdtocatch) {... Later in a method Animal pigeon

More information

Lecture Outline. COOL operational semantics. Operational Semantics of Cool. Motivation. Notation. The rules. Evaluation Rules So Far.

Lecture Outline. COOL operational semantics. Operational Semantics of Cool. Motivation. Notation. The rules. Evaluation Rules So Far. Lecture Outline Operational Semantics of Cool COOL operational semantics Motivation Adapted from Lectures by Profs. Alex Aiken and George Necula (UCB) Notation The rules CS781(Prasad) L24CG 1 CS781(Prasad)

More information

Chapter 9. Def: The subprogram call and return operations of a language are together called its subprogram linkage

Chapter 9. Def: The subprogram call and return operations of a language are together called its subprogram linkage Def: The subprogram call and return operations of a language are together called its subprogram linkage Implementing FORTRAN 77 Subprograms Call Semantics: 1. Save the execution status of the caller 2.

More information

5th World Congress for Software Quality Shanghai, China November 2011

5th World Congress for Software Quality Shanghai, China November 2011 Yoshihiro Kita University of Miyazaki Miyazaki, Japan kita@earth.cs.miyazaki-u.ac.jp Proposal of Execution Paths Indication Method for Integration Testing by Using an Automatic Visualization Tool Avis

More information

JAVA GUI PROGRAMMING REVISION TOUR III

JAVA GUI PROGRAMMING REVISION TOUR III 1. In java, methods reside in. (a) Function (b) Library (c) Classes (d) Object JAVA GUI PROGRAMMING REVISION TOUR III 2. The number and type of arguments of a method are known as. (a) Parameter list (b)

More information

Software Testing - Introduction -

Software Testing - Introduction - Software Testing - Introduction - Bugs? What is testing? The RIP model. How important is testing? Test case, test requirement, coverage criteria, coverage level, criteria subsumption. An introduction to

More information

Lecture Outline. COOL operational semantics. Operational Semantics of Cool. Motivation. Lecture 13. Notation. The rules. Evaluation Rules So Far

Lecture Outline. COOL operational semantics. Operational Semantics of Cool. Motivation. Lecture 13. Notation. The rules. Evaluation Rules So Far Lecture Outline Operational Semantics of Cool Lecture 13 COOL operational semantics Motivation Notation The rules Prof. Aiken CS 143 Lecture 13 1 Prof. Aiken CS 143 Lecture 13 2 Motivation We must specify

More information

Compiler Design Spring 2017

Compiler Design Spring 2017 Compiler Design Spring 2017 7.5 Method invocation Dr. Zoltán Majó Compiler Group Java HotSpot Virtual Machine Oracle Corporation 1 Admin issues There will be a recitation session today In CAB G 11 @ 15:15

More information

Outline. Register Allocation. Issues. Storing values between defs and uses. Issues. Issues P3 / 2006

Outline. Register Allocation. Issues. Storing values between defs and uses. Issues. Issues P3 / 2006 P3 / 2006 Register Allocation What is register allocation Spilling More Variations and Optimizations Kostis Sagonas 2 Spring 2006 Storing values between defs and uses Program computes with values value

More information

Program Verification (6EC version only)

Program Verification (6EC version only) Program Verification (6EC version only) Erik Poll Digital Security Radboud University Nijmegen Overview Program Verification using Verification Condition Generators JML a formal specification language

More information

Logic Coverage. Moonzoo Kim School of Computing KAIST. The original slides are taken from Chap. 8 of Intro. to SW Testing 2 nd ed by Ammann and Offutt

Logic Coverage. Moonzoo Kim School of Computing KAIST. The original slides are taken from Chap. 8 of Intro. to SW Testing 2 nd ed by Ammann and Offutt Logic Coverage Moonzoo Kim School of Computing KAIST The original slides are taken from Chap. 8 of Intro. to SW Testing 2 nd ed by Ammann and Offutt Covering Logic Expressions Logic expressions show up

More information

Software Quality Assurance & Testing

Software Quality Assurance & Testing Software Quality Assurance & Testing 1.Software Testing - An ISTQB-BCS Certified Tester Foundation Guide 3rd edition, 2015 Brian Hambling, Peter Morgan, Geoff Thompson, Peter Williams,Angelina Samaroo

More information

Input Validation Testing: A Requirements-Driven, System level, Early Lifecycle Technique

Input Validation Testing: A Requirements-Driven, System level, Early Lifecycle Technique Input Validation Testing: A Requirements-Driven, System level, Early Lifecycle Technique Jane Hayes Jeff Offutt SAIC George Mason University jane.e.hayes@cpmx.saic.com ofut@gmu.edu Support from U.S.National

More information

Outline. iterator review iterator implementation the Java foreach statement testing

Outline. iterator review iterator implementation the Java foreach statement testing Outline iterator review iterator implementation the Java foreach statement testing review: Iterator methods a Java iterator only provides two or three operations: E next(), which returns the next element,

More information

Data Flow Analysis. CSCE Lecture 9-02/15/2018

Data Flow Analysis. CSCE Lecture 9-02/15/2018 Data Flow Analysis CSCE 747 - Lecture 9-02/15/2018 Data Flow Another view - program statements compute and transform data So, look at how that data is passed through the program. Reason about data dependence

More information

CS18000: Programming I

CS18000: Programming I CS18000: Programming I Testing Basics 19 April 2010 Prof. Chris Clifton Testing Programs Your programs are getting large and more complex How do you make sure they work? 1. Reason about the program Think

More information

Integration Testing of Object-oriented Components Using FSMS: Theory and Experimental Details

Integration Testing of Object-oriented Components Using FSMS: Theory and Experimental Details Integration Testing of Object-oriented Components Using FSMS: Theory and Experimental Details GMU Technical Report ISE-TR-04-04, July 2004 Leonard Gallagher Information Technology Laboratory National Institute

More information

Fault Localization Using Tarantula

Fault Localization Using Tarantula Class 20 Fault localization (cont d) Test-data generation Exam review: Nov 3, after class to :30 Responsible for all material up troug Nov 3 (troug test-data generation) Send questions beforeand so all

More information

M e t h o d s a n d P a r a m e t e r s

M e t h o d s a n d P a r a m e t e r s M e t h o d s a n d P a r a m e t e r s Objective #1: Call methods. Methods are reusable sections of code that perform actions. Many methods come from classes that are built into the Java language. For

More information

CSCI 261 Computer Science II

CSCI 261 Computer Science II CSCI 261 Computer Science II Department of Mathematics and Computer Science Lecture 3 Complexity Analysis and the Big-O Notation My Mom 2 My Mom Is a Human Yardstick All my mom ever does is compare things

More information

Object-oriented programming. and data-structures CS/ENGRD 2110 SUMMER 2018

Object-oriented programming. and data-structures CS/ENGRD 2110 SUMMER 2018 Object-oriented programming 1 and data-structures CS/ENGRD 2110 SUMMER 2018 Lecture 1: Types and Control Flow http://courses.cs.cornell.edu/cs2110/2018su Lecture 1 Outline 2 Languages Overview Imperative

More information

Software Quality Engineering Exercises

Software Quality Engineering Exercises Software Quality Engineering Exercises Exercise 1 The following program computes the greatest common divisor of two natural numbers by Euclid s algorithm. Begin input(x,y); While(x>0 and y>0) Do If (x>y)

More information

Technical Section. Lab 4 while loops and for loops. A. while Loops or for loops

Technical Section. Lab 4 while loops and for loops. A. while Loops or for loops Lab 4 while loops and for loops The purpose of this lab is to introduce you to the concept of a for loop, gain experience distinguishing between a while loop (which is a more general type of loop than

More information

Introduction to Software Testing Chapter 5.1 Syntax-based Testing

Introduction to Software Testing Chapter 5.1 Syntax-based Testing Introduction to Software Testing Chapter 5.1 Syntax-based Testing Paul Ammann & Jeff Offutt http://www.cs.gmu.edu/~offutt/ softwaretest/ Ch. 5 : Syntax Coverage Four Structures for Modeling Software Graphs

More information

Flow-sensitive rewritings and Inliner improvements for the Graal JIT compiler

Flow-sensitive rewritings and Inliner improvements for the Graal JIT compiler 1 / 25 Flow-sensitive rewritings and for the Graal JIT compiler Miguel Garcia http://lampwww.epfl.ch/~magarcia/ 2014-07-07 2 / 25 Outline Flow-sensitive rewritings during HighTier Example Rewritings in

More information

GENERATING COST-EFFECTIVE CRITERIA-BASED TESTS FROM BEHAVIORAL MODELS

GENERATING COST-EFFECTIVE CRITERIA-BASED TESTS FROM BEHAVIORAL MODELS GENERATING COST-EFFECTIVE CRITERIA-BASED TESTS FROM BEHAVIORAL MODELS by Nan Li A Dissertation Submitted to the Graduate Faculty of George Mason University In Partial Fulfillment of The Requirements for

More information

CS 314 Principles of Programming Languages. Lecture 13

CS 314 Principles of Programming Languages. Lecture 13 CS 314 Principles of Programming Languages Lecture 13 Zheng Zhang Department of Computer Science Rutgers University Wednesday 19 th October, 2016 Zheng Zhang 1 CS@Rutgers University Class Information Reminder:

More information

Module 10: Imperative Programming, Modularization, and The Future

Module 10: Imperative Programming, Modularization, and The Future Module 10: Imperative Programming, Modularization, and The Future If you have not already, make sure you Read How to Design Programs Sections 18. 1 CS 115 Module 10: Imperative Programming, Modularization,

More information

Announcements. PS 3 is due Thursday, 10/6. Midterm Exam 1: 10/14 (Fri), 9:00am-10:53am

Announcements. PS 3 is due Thursday, 10/6. Midterm Exam 1: 10/14 (Fri), 9:00am-10:53am Announcements PS 3 is due Thursday, 10/6 Midterm Exam 1: 10/14 (Fri), 9:00am-10:53am Room TBD Scope: Lecture 1 to Lecture 9 (Chapters 1 to 6 of text) You may bring a sheet of paper (A4, both sides) Tutoring

More information

Operational Semantics of Cool

Operational Semantics of Cool Operational Semantics of Cool Key Concepts semantics: the meaning of a program, what does program do? how the code is executed? operational semantics: high level code generation steps of calculating values

More information

Introduction to Computer Programming for Non-Majors

Introduction to Computer Programming for Non-Majors Introduction to Computer Programming for Non-Majors CSC 2301, Fall 2015 Chapter 6 Part 1 The Department of Computer Science Objectives 2 To understand why programmers divide programs up into sets of cooperating

More information

Interprocedural Analysis. Motivation. Interprocedural Analysis. Function Calls and Pointers

Interprocedural Analysis. Motivation. Interprocedural Analysis. Function Calls and Pointers Interprocedural Analysis Motivation Last time Introduction to alias analysis Today Interprocedural analysis Procedural abstraction Cornerstone of programming Introduces barriers to analysis Example x =

More information

G Programming Languages Spring 2010 Lecture 4. Robert Grimm, New York University

G Programming Languages Spring 2010 Lecture 4. Robert Grimm, New York University G22.2110-001 Programming Languages Spring 2010 Lecture 4 Robert Grimm, New York University 1 Review Last week Control Structures Selection Loops 2 Outline Subprograms Calling Sequences Parameter Passing

More information

What the optimizer does to your code

What the optimizer does to your code 1 / 12 Miguel Garcia http://lamp.epfl.ch/~magarcia LAMP, EPFL 2012-04-18 2 / 12 Outline Things the optimizer is good at Example Pros and Cons Early inlining Parallelizing an optimization phase Further

More information

Functions Overview. Functions (aka procedures, subroutines, or methods) are the unit of code decomposition and abstraction

Functions Overview. Functions (aka procedures, subroutines, or methods) are the unit of code decomposition and abstraction 1 Unit 14 Functions Function Decomposition 2 Functions Overview Functions (aka procedures, subroutines, or methods) are the unit of code decomposition and abstraction Map Service ValidateInputs() RetrieveMap()

More information

CSC 2400: Computer Systems. Using the Stack for Function Calls

CSC 2400: Computer Systems. Using the Stack for Function Calls CSC 24: Computer Systems Using the Stack for Function Calls Lecture Goals Challenges of supporting functions! Providing information for the called function Function arguments and local variables! Allowing

More information

Operational Semantics of Cool

Operational Semantics of Cool Operational Semantics of Cool Lecture 23 Dr. Sean Peisert ECS 142 Spring 2009 1 Status Project 3 due on Friday Project 4 assigned on Friday. Due June 5, 11:55pm Office Hours this week Fri at 11am No Class

More information

We have written lots of code so far It has all been inside of the main() method What about a big program? The main() method is going to get really

We have written lots of code so far It has all been inside of the main() method What about a big program? The main() method is going to get really Week 9: Methods 1 We have written lots of code so far It has all been inside of the main() method What about a big program? The main() method is going to get really long and hard to read Sometimes you

More information

Testing: Dataflow Coverage

Testing: Dataflow Coverage Testing: Dataflow Coverage Testing, Quality Assurance, and Maintenance Winter 2018 Arie Gurfinkel based on slides by Thibaud Lutellier, Marsha Chechik and Prof. Lin Tan Non-looping Path Selection Problem

More information

Defect Detection at Microsoft Where the Rubber Meets the Road

Defect Detection at Microsoft Where the Rubber Meets the Road Defect Detection at Microsoft Where the Rubber Meets the Road Manuvir Das (and too many others to list) Program Analysis Group Center for Software Excellence Microsoft Corporation Bottom line Defect detection

More information

Introduction to Software Testing Chapter 4 Input Space Partition Testing

Introduction to Software Testing Chapter 4 Input Space Partition Testing Introduction to Software Testing Chapter 4 Input Space Partition Testing Paul Ammann & Jeff Offutt http://www.cs.gmu.edu/~offutt/ softwaretest/ Ch. 4 : Input Space Coverage Four Structures for Modeling

More information

The SPL Programming Language Reference Manual

The SPL Programming Language Reference Manual The SPL Programming Language Reference Manual Leonidas Fegaras University of Texas at Arlington Arlington, TX 76019 fegaras@cse.uta.edu February 27, 2018 1 Introduction The SPL language is a Small Programming

More information

G Programming Languages - Fall 2012

G Programming Languages - Fall 2012 G22.2110-003 Programming Languages - Fall 2012 Lecture 4 Thomas Wies New York University Review Last week Control Structures Selection Loops Adding Invariants Outline Subprograms Calling Sequences Parameter

More information

System Software Assignment 1 Runtime Support for Procedures

System Software Assignment 1 Runtime Support for Procedures System Software Assignment 1 Runtime Support for Procedures Exercise 1: Nested procedures Some programming languages like Oberon and Pascal support nested procedures. 1. Find a run-time structure for such

More information

Written exam TDDD04 Software Testing

Written exam TDDD04 Software Testing LiTH, Linköpings tekniska högskola IDA, Institutionen för datavetenskap Ola Leifler Written exam TDDD04 Software Testing 2016-10-26 Permissible aids Dictionary (printed, NOT electronic) Teacher on duty

More information

Integrating White- and Black-Box Techniques for Class-Level Regression Testing

Integrating White- and Black-Box Techniques for Class-Level Regression Testing Integrating White- and Black-Box Techniques for Class-Level Regression Testing Sami Beydeda, Volker Gruhn University of Dortmund Computer Science Department Software Technology 44221 Dortmund, Germany

More information

Testing: Coverage and Structural Coverage

Testing: Coverage and Structural Coverage Testing: Coverage and Structural Coverage Testing, Quality Assurance, and Maintenance Winter 2017 Prof. Arie Gurfinkel based on slides by Prof. Marsha Chechik and Prof. Lin Tan How would you test this

More information

Operational Semantics. One-Slide Summary. Lecture Outline

Operational Semantics. One-Slide Summary. Lecture Outline Operational Semantics #1 One-Slide Summary Operational semantics are a precise way of specifying how to evaluate a program. A formal semantics tells you what each expression means. Meaning depends on context:

More information