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

Size: px
Start display at page:

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

Transcription

1 Tes)ng (2nd edi(on) Overview Graph Coverage Criteria Paul Ammann & Jeff OffuA hap:// so,waretest/ First version, 23 September 2013

2 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 Tes)ng, Edi)on 2 (Ch 06) Use cases Integ Input Ammann & OffuA 2

3 Covering Graphs (6.1) Graphs are the most commonly used structure for tes)ng Graphs can come from many sources Control flow graphs Design structure FSMs and statecharts Use cases Tests usually are intended to cover the graph in some way Tes)ng, Edi)on 2 (Ch 06) Ammann & OffuA 3

4 Defini)on of a Graph A set N of nodes, N is not empty A set N 0 of ini)al nodes, N 0 is not empty A set N f of final nodes, N f is not empty A set E of edges, each edge from one node to another ( n i, n j ), i is predecessor, j is successor Tes)ng, Edi)on 2 (Ch 06) Ammann & OffuA 4

5 Three Example Graphs Not a valid graph N 0 = { 1} N 0 = { 1, 2, 3 } N 0 = { } N f = { 4 } N f = { 8, 9, 10 } N f = { 4 } Tes)ng, Edi)on 2 (Ch 06) Ammann & OffuA 5

6 Paths in Graphs Path : A sequence of nodes [n 1, n 2,, n M ] Each pair of nodes is an edge Length : The number of edges A single node is a path of length 0 Subpath : A subsequence of nodes in p is a subpath of p Reach (n) : Subgraph that can be reached from n A Few Paths [ 1, 4, 8 ] [ 2, 5, 9, 6, 2 ] [ 3, 7, 10 ] Reach (1) = { 1, 4, 5, 8, 9, 6, 2, 10 } Reach ({1, 3}) = G Reach([3,7]) = {3, 7, 10} 8 9 Tes)ng, Edi)on 2 (Ch 06) 10 Ammann & OffuA 6

7 Test Paths and SESEs Test Path : A path that starts at an ini)al node and ends at a final node Test paths represent execu)on of test cases Some test paths can be executed by many tests Some test paths cannot be executed by any tests SESE graphs : All test paths start at a single node and end at another node Single-entry, single-exit N0 and Nf have exactly one node Double-diamond graph Four test paths [1, 2, 4, 5, 7] [1, 2, 4, 6, 7] [1, 3, 4, 5, 7] [1, 3, 4, 6, 7] Tes)ng, Edi)on 2 (Ch 06) Ammann & OffuA 7

8 Visi)ng and Touring Visit : A test path p visits node n if n is in p A test path p visits edge e if e is in p Tour : A test path p tours subpath q if q is a subpath of p Path [ 1, 2, 4, 5, 7 ] Visits nodes 1, 2, 4, 5, 7 Visits edges (1, 2), (2, 4), (4, 5), (5, 7) Tours subpaths [1, 2, 4], [2, 4, 5], [4, 5, 7], [1, 2, 4, 5], [2, 4, 5, 7] Tes)ng, Edi)on 2 (Ch 06) Ammann & OffuA 8

9 Tests and Test Paths path (t) : The test path executed by test t path (T) : The set of test paths executed by the set of tests T Each test executes one and only one test path A loca)on in a graph (node or edge) can be reached from another loca)on if there is a sequence of edges from the first loca)on to the second Syntac(c reach : A subpath exists in the graph Seman(c reach : A test exists that can execute that subpath Tes)ng, Edi)on 2 (Ch 06) Ammann & OffuA 9

10 test 1 Tests and Test Paths many-to-one test 2 test 3 Test Path Deterministic software a test always executes the same test path test 1 test 2 test 3 many-to-many Test Path 1 Test Path 2 Test Path 3 Non-deterministic software a test can execute different test paths Tes)ng, Edi)on 2 (Ch 06) Ammann & OffuA 10

11 Tes)ng and Covering Graphs (6.2) We use graphs in tes)ng as follows : Developing a model of the so,ware as a graph Requiring tests to visit or tour specific sets of nodes, edges or subpaths Test Requirements (TR) : Describe properties of test paths Test Criterion : Rules that define test requirements Satisfaction : Given a set TR of test requirements for a criterion C, a set of tests T satisfies C on a graph if and only if for every test requirement in TR, there is a test path in path(t) that meets the test requirement tr Structural Coverage Criteria : Defined on a graph just in terms of nodes and edges Data Flow Coverage Criteria : Requires a graph to be annotated with references to variables Tes)ng, Edi)on 2 (Ch 06) Ammann & OffuA 11

12 Node and Edge Coverage The first (and simplest) two criteria require that each node and edge in a graph be executed Node Coverage (NC) : Test set T satisfies node coverage on graph G iff for every syntactically reachable node n in N, there is some path p in path(t) such that p visits n. This statement is a bit cumbersome, so we abbreviate it in terms of the set of test requirements Node Coverage (NC) : TR contains each reachable node in G. Tes)ng, Edi)on 2 (Ch 06) Ammann & OffuA 12

13 2 1 Structural Coverage Example Node Coverage TR = { 1, 2, 3, 4, 5, 6, 7 } Test Paths: [ 1, 2, 3, 4, 7 ] [ 1, 2, 3, 5, 6, 5, 7 ] Edge Coverage TR = { (1,2), (1, 3), (2, 3), (3, 4), (3, 5), (4, 7), (5, 6), (5, 7), (6, 5) } Test Paths: [ 1, 2, 3, 4, 7 ] [1, 3, 5, 6, 5, 7 ] Edge-Pair Coverage TR = {[1,2,3], [1,3,4], [1,3,5], [2,3,4], [2,3,5], [3,4,7], [3,5,6], [3,5,7], [5,6,5], [6,5,6], [6,5,7] } Test Paths: [ 1, 2, 3, 4, 7 ] [ 1, 2, 3, 5, 7 ] [ 1, 3, 4, 7 ] [ 1, 3, 5, 6, 5, 6, 5, 7 ] Complete Path Coverage Test Paths: [ 1, 2, 3, 4, 7 ] [ 1, 2, 3, 5, 7 ] [ 1, 2, 3, 5, 6, 5, 6 ] [ 1, 2, 3, 5, 6, 5, 6, 5, 7 ] [ 1, 2, 3, 5, 6, 5, 6, 5, 6, 5, 7 ] Tes)ng, Edi)on 2 (Ch 06) Ammann & OffuA 13

14 Loops in Graphs If a graph contains a loop, it has an infinite number of paths Thus, CPC is not feasible SPC is not sa)sfactory because the results are subjec)ve and vary with the tester AAempts to deal with loops: 1970s : Execute cycles once ([4, 5, 4] in previous example, informal) 1980s : Execute each loop, exactly once (formalized) 1990s : Execute loops 0 )mes, once, more than once (informal descrip)on) 2000s : Prime paths Tes)ng, Edi)on 2 (Ch 06) Ammann & OffuA 14

15 Simple Paths and Prime Paths Simple Path : A path from node ni to nj is simple if no node appears more than once, except possibly the first and last nodes are the same No internal loops A loop is a simple path Prime Path : A simple path that does not appear as a proper subpath of any other simple path Simple Paths : [1,2,4,1], [1,3,4,1], [2,4,1,2], [2,4,1,3], [3,4,1,2], [3,4,1,3], [4,1,2,4], [4,1,3,4], [1,2,4], [1,3,4], [2,4,1], [3,4,1], [4,1,2], [4,1,3], [1,2], [1,3], [2,4], [3,4], [4,1], [1], [2], [3], [4] Prime Paths : [2,4,1,2], [2,4,1,3], [1,3,4,1], [1,2,4,1], [3,4,1,2], [4,1,3,4], [4,1,2,4], [3,4,1,3] Tes)ng, Edi)on 2 (Ch 06) Ammann & OffuA 15

16 Prime Path Coverage A simple, elegant and finite criterion that requires loops to be executed as well as skipped Prime Path Coverage (PPC) : TR contains each prime path in G. Will tour all paths of length 0, 1, That is, it subsumes node and edge coverage PPC does NOT subsume EPC If a node n has an edge to itself, EPC will require [n, n, m] [n, n, m] is not prime Tes)ng, Edi)on 2 (Ch 06) Ammann & OffuA 16

17 Round Trips Round-Trip Path : A prime path that starts and ends at the same node Simple Round Trip Coverage (SRTC) : TR contains at least one round-trip path for each reachable node in G that begins and ends a round-trip path. Complete Round Trip Coverage (CRTC) : TR contains all roundtrip paths for each reachable node in G. These criteria omit nodes and edges that are not in round trips That is, they do not subsume edge-pair, edge, or node coverage Tes)ng, Edi)on 2 (Ch 06) Ammann & OffuA 17

18 Prime Path Example The previous example has 38 simple paths Only nine prime paths Prime Paths [1, 2, 3, 4, 7] [1, 2, 3, 5, 7] [1, 2, 3, 5, 6] [1, 3, 4, 7] [1, 3, 5, 7] [1, 3, 5, 6] [6, 5, 7] [6, 5, 6] [5, 6, 5] Execute loop 0 )mes Execute loop once Execute loop more than once Tes)ng, Edi)on 2 (Ch 06) Ammann & OffuA 18

19 Touring, Sidetrips and Detours Prime paths do not have internal loops test paths might Tour : A test path p tours subpath q if q is a subpath of p Tour With Sidetrips : A test path p tours subpath q with sidetrips iff every edge in q is also in p in the same order The tour can include a sidetrip, as long as it comes back to the same node Tour With Detours : A test path p tours subpath q with detours iff every node in q is also in p in the same order The tour can include a detour from node ni, as long as it comes back to the prime path at a successor of ni Tes)ng, Edi)on 2 (Ch 06) Ammann & OffuA 19

20 Overview A common applica)on of graph criteria is to program source Graph : Usually the control flow graph (CFG) Node coverage : Execute every statement Edge coverage : Execute every branch Loops : Looping structures such as for loops, while loops, etc. Data flow coverage : Augment the CFG defs are statements that assign values to variables uses are statements that use variables Tes)ng, Edi)on 2 (Ch 6) Ammann & OffuA 20

21 Control Flow Graphs A CFG models all execu)ons of a method by describing control structures Nodes : Statements or sequences of statements (basic blocks) Edges : Transfers of control Basic Block : A sequence of statements such that if the first statement is executed, all statements will be (no branches) CFGs are some)mes annotated with extra informa)on branch predicates defs uses Rules for transla)ng statements into graphs Tes)ng, Edi)on 2 (Ch 6) Ammann & OffuA 21

22 CFG : The if Statement if (x < y) { y = 0; 1 x = x + 1; x < y x >= y } y = 0 else x = x { x = y; } 4 x = y if (x < y) { y = 0; x = x + 1; } y = 0 x = x + 1 x < y 2 1 x >= y 3 Tes)ng, Edi)on 2 (Ch 6) Ammann & OffuA 22

23 CFG : The if-return Statement if (x < y) { return; } print (x); return; return x < y 2 1 x >= y 3 print (x) return No edge from node 2 to 3. The return nodes must be distinct. Tes)ng, Edi)on 2 (Ch 6) Ammann & OffuA 23

24 Loops Loops require extra nodes to be added Nodes that do not represent statements or basic blocks Tes)ng, Edi)on 2 (Ch 6) Ammann & OffuA 24

25 CFG : while and for Loops x = 0; while (x < y) { y = f (x, y); x = x + 1; } x = 0 x < y y =f(x,y) x = x + 1 x >= y 4 dummy node for (x = 0; x < y; x++) { y = f (x, y); } implicitly initializes loop y = f (x, y) x = 0 x < y x >= y x = x + 1 Tes)ng, Edi)on 2 (Ch 6) implicitly increments loop Ammann & OffuA 25

26 CFG : do Loop, break and con)nue x = 0; do { y = f (x, y); x = x + 1; } while (x < y); println (y) x = 0 x >= y Tes)ng, Edi)on 2 (Ch 6) y = f (x, y) x = x+1 x < y x = 0; while (x < y) { y = f (x, y); if (y == 0) { break; } else if y < 0) { y = y*2; continue; } x = x + 1; } print (y); 1 x = Ammann & OffuA y =f(x,y) y == 0 4 y < 0 6 x = x + 1 break y = y*2 con)nue

27 CFG : The case (switch) Structure read ( c) ; switch ( c ) { case N : y = 25; break; case Y : y = 50; break; default: y = 0; break; } print (y); y = 25; break; c == N 1 read ( c ); c == Y default y = 50; break; 5 print (y); y = 0; break; Tes)ng, Edi)on 2 (Ch 6) Ammann & OffuA 27

28 Example Control Flow Stats 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 (int i = 0; i < length; i++) { varsum = varsum + ((numbers [ I ] - mean) * (numbers [ I ] - mean)); } var = varsum / ( length ); sd = Math.sqrt ( var ); } Tes)ng, Edi)on 2 (Ch 6) System.out.println ("length: " + length); System.out.println ("mean: System.out.println ("median: " + mean); " + med); System.out.println ("variance: " + var); System.out.println ("standard deviation: " + sd); Ammann & OffuA Ammann & OffuA 28

29 Control Flow Graph for Stats 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; i = 0 i >= length } Tes)ng, Edi)on 2 (Ch 6) varsum = 0; i < length for (int i = 0; i < length; i++) { i++ 4 varsum = varsum + ((numbers [ I ] - mean) * (numbers [ I ] - mean)); } var = varsum / ( length ); sd = Math.sqrt ( var ); System.out.println ("length: " + length); System.out.println ("mean: System.out.println ("median: " + mean); " + med); System.out.println ("variance: " + var); System.out.println ("standard deviation: " + sd); Ammann & OffuA Ammann & OffuA i = 0 i < length i >= length 7 i

30 Control Flow TRs and Test Paths EC 1 Edge Coverage TR A. [ 1, 2 ] B. [ 2, 3 ] C. [ 3, 4 ] D. [ 3, 5 ] E. [ 4, 3 ] F. [ 5, 6 ] G. [ 6, 7 ] H. [ 6, 8 ] I. [ 7, 6 ] Test Path [ 1, 2, 3, 4, 3, 5, 6, 7, 6, 8 ] 7 8 Tes)ng, Edi)on 2 (Ch 6) Ammann & OffuA 30

31 Control Flow TRs and Test Paths EPC 1 Edge-Pair Coverage Tes)ng, Edi)on 2 (Ch 6) TR A. [ 1, 2, 3 ] B. [ 2, 3, 4 ] C. [ 2, 3, 5 ] D. [ 3, 4, 3 ] E. [ 3, 5, 6 ] F. [ 4, 3, 5 ] G. [ 5, 6, 7 ] H. [ 5, 6, 8 ] I. [ 6, 7, 6 ] J. [ 7, 6, 8 ] K. [ 4, 3, 4 ] L. [ 7, 6, 7 ] Ammann & OffuA Test Paths i. [ 1, 2, 3, 4, 3, 5, 6, 7, 6, 8 ] ii. [ 1, 2, 3, 5, 6, 8 ] iii. [ 1, 2, 3, 4, 3, 4, 3, 5, 6, 7, 6, 7, 6, 8 ] TP TRs toured sidetrips i A, B, D, E, F, G, I, J C, H ii A, C, E, H iii A, B, D, E, F, G, I, J, K, L C, H 31

32 4 7 Control Flow TRs and Test Paths PPC Tes)ng, Edi)on 2 (Ch 6) TR A. [ 3, 4, 3 ] B. [ 4, 3, 4 ] C. [ 7, 6, 7 ] D. [ 7, 6, 8 ] E. [ 6, 7, 6 ] F. [ 1, 2, 3, 4 ] G. [ 4, 3, 5, 6, 7 ] H. [ 4, 3, 5, 6, 8 ] I. [ 1, 2, 3, 5, 6, 7 ] J. [ 1, 2, 3, 5, 6, 8 ] 8 Prime Path Coverage Ammann & OffuA Test Paths i. [ 1, 2, 3, 4, 3, 5, 6, 7, 6, 8 ] ii. [ 1, 2, 3, 4, 3, 4, 3, 5, 6, 7, 6, 7, 6, 8 ] iii. [ 1, 2, 3, 4, 3, 5, 6, 8 ] iv. [ 1, 2, 3, 5, 6, 7, 6, 8 ] v. [ 1, 2, 3, 5, 6, 8 ] TP TRs toured sidetrips i A, D, E, F, G H, I, J ii A, B, C, D, E, F, G, H, I, J iii A, F, H J iv D, E, F, I J v J 32

33 CITS5501 So,ware Quality and Tes)ng Logic and Path Coverage From Introduc(on to SoFware Tes(ng, 2 nd ed, Ammann & OffuL

34 Ch. 3 : Logic 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 Introduction to Software Testing (Ch 3) Use cases Integ Input Ammann & Offutt 34

35 Covering Logic Expressions (3.1) Logic expressions show up in many situations Covering logic expressions is required by the US Federal Aviation Administration for safety critical software Logical expressions can come from many sources Decisions in programs FSMs and statecharts Requirements Tests are intended to choose some subset of the total number of truth assignments to the expressions Introduction to Software Testing (Ch 3) Ammann & Offutt 35

36 Logic Predicates and Clauses A predicate is an expression that evaluates to a boolean value Predicates can contain boolean variables non-boolean variables that contain >, <, ==, >=, <=,!= boolean function calls Internal structure is created by logical operators the negation operator the and operator the or operator the implication operator the exclusive or operator the equivalence operator A clause is a predicate with no logical operators Introduction to Software Testing (Ch 3) Ammann & Offutt 36

37 Examples (a < b) f (z) D (m >= n*o) Four clauses: (a < b) relational expression f (z) boolean-valued function D boolean variable (m >= n*o) relational expression Most predicates have few clauses It would be nice to quantify that claim! Sources of predicates Decisions in programs Guards in finite state machines Decisions in UML activity graphs Requirements, both formal and informal SQL queries Introduction to Software Testing (Ch 3) Ammann & Offutt 37

38 Testing and Covering Predicates (3.2) We use predicates in testing as follows : Developing a model of the software as one or more predicates Requiring tests to satisfy some combination of clauses Abbreviations: P is the set of predicates p is a single predicate in P C is the set of clauses in P C p is the set of clauses in predicate p c is a single clause in C Introduction to Software Testing (Ch 3) Ammann & Offutt 38

39 Predicate and Clause Coverage The first (and simplest) two criteria require that each predicate and each clause be evaluated to both true and false Predicate Coverage (PC) : For each p in P, TR contains two requirements: p evaluates to true, and p evaluates to false. When predicates come from condi)ons on edges, this is equivalent to edge coverage PC does not evaluate all the clauses, so Clause Coverage (CC) : For each c in C, TR contains two requirements: c evaluates to true, and c evaluates to false. Introduction to Software Testing (Ch 3) Ammann & Offutt 39

40 Predicate Coverage Example ((a < b) D) (m >= n*o) predicate coverage Predicate = true a = 5, b = 10, D = true, m = 1, n = 1, o = 1 = (5 < 10) true (1 >= 1*1) = true true TRUE = true Predicate = false a = 10, b = 5, D = false, m = 1, n = 1, o = 1 = (10 < 5) false (1 >= 1*1) = false false TRUE = false Introduction to Software Testing (Ch 3) Ammann & Offutt 40

41 Clause Coverage Example ((a < b) D) (m >= n*o) Clause coverage (a < b) = true (a < b) = false D = true D = false a = 5, b = 10 a = 10, b = 5 D = true D = false m >= n*o = true m = 1, n = 1, o = 1 m >= n*o = false m = 1, n = 2, o = 2 false cases true cases Two tests 1) a = 5, b = 10, D = true, m = 1, n = 1, o = 1 2) a = 10, b = 5, D = false, m = 1, n = 2, o = 2 Introduction to Software Testing (Ch 3) Ammann & Offutt 41

42 Problems with PC and CC PC does not fully exercise all the clauses, especially in the presence of short circuit evaluation CC does not always ensure PC That is, we can satisfy CC without causing the predicate to be both true and false This is definitely not what we want! The simplest solution is to test all combinations Introduction to Software Testing (Ch 3) Ammann & Offutt 42

43 Combinatorial Coverage CoC requires every possible combination Sometimes called Multiple Condition Coverage Combinatorial Coverage (CoC) : For each p in P, TR has test requirements for the clauses in Cp to evaluate to each possible combination of truth values. a < b D m >= n*o ((a < b) D) (m >= n*o) 1 T T T T 2 T T F F 3 T F T T 4 T F F F 5 F T T T 6 F T F F 7 F F T F 8 F F F F Introduction to Software Testing (Ch 3) Ammann & Offutt 43

44 Combinatorial Coverage This is simple, neat, clean, and comprehensive But quite expensive! 2 N tests, where N is the number of clauses Imprac)cal for predicates with more than 3 or 4 clauses The literature has lots of sugges)ons some confusing The general idea is simple: Test each clause independently from the other clauses Geng the details right is hard What exactly does independently mean? The book presents this idea as making clauses ac(ve Introduction to Software Testing (Ch 3) Ammann & Offutt 44

45 Active Clauses Clause coverage has a weakness : The values do not always make a difference Consider the first test for clause coverage, which caused each clause to be true: (5 < 10) true (1 >= 1*1) Only the first clause counts! To really test the results of a clause, the clause should be the determining factor in the value of the predicate Determination : A clause c i in predicate p, called the major clause, determines p if and only if the values of Introduction to Software Testing (Ch 3) the remaining minor clauses c j are such that changing c i changes the value of p This is considered to make the clause ac(ve Ammann & Offutt 45

46 Determining Predicates P = A B if B = true, p is always true. so if B = false, A determines p. if A = false, B determines p. P = A B if B = false, p is always false. so if B = true, A determines p. if A = true, B determines p. Goal : Find tests for each clause when the clause determines the value of the predicate This is formalized in several criteria that have subtle, but very important, differences Introduction to Software Testing (Ch 3) Ammann & Offutt 46

47 General and Restricted ICC Unlike ACC, the notion of correlation is not relevant ci does not determine p, so cannot correlate with p Predicate coverage is always guaranteed General Inactive Clause Coverage (GICC) : For each p in P and each major clause c i in Cp, choose minor clauses c j, j!= i, so that c i does not determine p. The values chosen for the minor clauses c j do not need to be the same when c i is true as when c i is false, that is, c j (c i = true) = c j (c i = false) for all c j OR c j (c i = true)!= c j (c i = false) for all c j. Restricted Inactive Clause Coverage (RICC) : For each p in P and each major clause c i in Cp, choose minor clauses c j, j!= i, so that c i does not determine p. The values chosen for the minor clauses cj must be the same when c i is true as when c i is false, that is, it is required that c j (c i = true) = c j (c i = false) for all c j. Introduction to Software Testing (Ch 3) Ammann & Offutt 47

48 Logic Coverage Criteria Subsumption Combinatorial Clause Coverage COC Restricted Active Clause Coverage RACC Correlated Active Clause Coverage CACC Restricted Inactive Clause Coverage RICC General Inactive Clause Coverage GICC General Active Clause Coverage GACC Introduction to Software Testing (Ch 3) Clause Coverage CC Predicate Coverage PC Ammann & Offutt 48

49 Making Clauses Determine a Predicate Finding values for minor clauses c j is easy for simple predicates But how to find values for more complicated predicates? Definitional approach: p c=true is predicate p with every occurrence of c replaced by true p c=false is predicate p with every occurrence of c replaced by false To find values for the minor clauses, connect p c=true and p c=false with exclusive OR p c = p c=true p c=false After solving, p c describes exactly the values needed for c to determine p Introduction to Software Testing (Ch 3) Ammann & Offutt 49

50 Examples p = a b p a = p a=true p a=false = (true b) XOR (false b) = true XOR b = b p = a b p a = p a=true p a=false = (true b) (false b) = b false = b Introduction to Software Testing (Ch 3) p = a (b c) p a = p a=true p a=false = (true (b c)) (false (b c)) = true (b c) = (b c) = b c NOT b NOT c means either b or c can be false RACC requires the same choice for both values of a, CACC does not Ammann & Offutt 50

51 Repeated Variables The definitions in this chapter yield the same tests no matter how the predicate is expressed (a b) (c b) == (a c) b (a b) (b c) (a c) Only has 8 possible tests, not 64 Use the simplest form of the predicate, and ignore contradictory truth table assignments Introduction to Software Testing (Ch 3) Ammann & Offutt 51

52 Introduction to Software Testing (Ch 3) A More Subtle Example p = ( a b ) ( a b) p a = p a=true p a=false = ((true b) (true b)) ((false b) (false b)) = (b b) false = true false = true p = ( a b ) ( a b) p b = p b=true p b=false = ((a true) (a true)) ((a false) (a false)) = (a false) (false a) = a a = false a always determines the value of this predicate b never determines the value b is irrelevant! Ammann & Offutt 52

53 Infeasible Test Requirements Consider the predicate: (a > b b > c) c > a (a > b) = true, (b > c) = true, (c > a) = true is infeasible As with graph-based criteria, infeasible test requirements have to be recognized and ignored Recognizing infeasible test requirements is hard, and in general, undecidable Software testing is inexact engineering, not science Introduction to Software Testing (Ch 3) Ammann & Offutt 53

54 Logic Expressions from Source Predicates are derived from decision statements in programs In programs, most predicates have less than four clauses Wise programmers actively strive to keep predicates simple When a predicate only has one clause, COC, ACC, ICC, and CC all collapse to predicate coverage (PC) Applying logic criteria to program source is hard because of reachability and controllability: Reachability : Before applying the criteria on a predicate at a particular statement, we have to get to that statement Controllability : We have to find input values that indirectly assign values to the variables in the predicates Variables in the predicates that are not inputs to the program are called internal variables Introduction to Software Testing (Ch 3) Ammann & Offutt 54

55 Specifications in Software Specifications can be formal or informal Formal specs are usually expressed mathematically Informal specs are usually expressed in natural language Lots of formal languages and informal styles are available Most specification languages include explicit logical expressions, so it is very easy to apply logic coverage criteria Implicit logical expressions in natural-language specifications should be re-written as explicit logical expressions as part of test design You will often find mistakes One of the most common is preconditions Introduction to Software Testing (Ch 3) Ammann & Offutt 55

56 Preconditions Programmers often include preconditions for their methods The preconditions are often expressed in comments in method headers Preconditions can be in javadoc, requires, pre, Example Saving addresses // name must not be empty // state must be valid // zip must be 5 numeric digits // street must not be empty // city must not be empty Conjunctive Normal Form Rewriting to logical expression name!= state in statelist zip >= zip <= street!= city!= Introduction to Software Testing (Ch 3) Ammann & Offutt 56

57 Covering Finite State Machines FSMs are graphs nodes represent state edges represent transitions among states Transitions often have logical expressions as guards or triggers Find a logical expression and cover it As we said: Introduction to Software Testing (Ch 3) Ammann & Offutt 57

58 Example Subway Train secondplatform = right All Doors Open secondplatform= left Le, Doors Open emergencystop overrideopen doorsclear (all three transitions) Right Doors Open trainspeed = 0 platform=left (instation (emergencystop overrideopen)) All Doors Closed trainspeed = 0 platform=right (instation (emergencystop overrideopen)) Introduction to Software Testing (Ch 3) Ammann & Offutt 58

59 Determination of the Predicate trainspeed = 0 platform=left (instation (emergencystop overrideopen)) trainspeed = 0 : platform = left (instation (emergencystop overrideopen)) platform = left : trainspeed = 0 (instation (emergencystop overrideopen)) instation : trainspeed = 0 platform = left ( emergencystop overrideopen) emergencystop : trainspeed = 0 platform = left ( instation overrideopen) overrideopen : trainspeed = 0 platform = left ( instation emergencystop) Introduction to Software Testing (Ch 3) Ammann & Offutt 59

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

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

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

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

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

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

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

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

Agenda. Predicate Testing. CSE 5321/4321, Ali Sharifara, UTA

Agenda. Predicate Testing. CSE 5321/4321, Ali Sharifara, UTA Agenda Predicate Testing CSE 5321/4321, Ali Sharifara, UTA 1 Predicate Testing Introduction Basic Concepts Predicate Coverage Summary CSE 5321/4321, Ali Sharifara, UTA 2 Motivation Predicates are expressions

More information

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

Graph Coverage for Source Code. Data Flow Graph Coverage for Source Code Graph Coverage for Source Code Data Flow Graph Coverage for Source Code 1 Graph Coverage for Design Elements Use of data abstraction and object oriented software has increased importance on modularity

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

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

Lecture 2. White- box Tes2ng and Structural Coverage (see Amman and Offut, Chapter 2)

Lecture 2. White- box Tes2ng and Structural Coverage (see Amman and Offut, Chapter 2) Lecture 2 White- box Tes2ng and Structural Coverage (see Amman and Offut, Chapter 2) White- box Tes2ng (aka. Glass- box or structural tes2ng) An error may exist at one (or more) loca2on(s) Line numbers

More information

Lecture 2. White- box Tes2ng and Structural Coverage (see Amman and Offut, Chapter 2)

Lecture 2. White- box Tes2ng and Structural Coverage (see Amman and Offut, Chapter 2) Lecture 2 White- box Tes2ng and Structural Coverage (see Amman and Offut, Chapter 2) White- box Tes2ng (aka. Glass- box or structural tes2ng) An error may exist at one (or more) loca2on(s) Line numbers

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

Logic-based test coverage

Logic-based test coverage Eduardo Marques, Vasco Thudichum Vasconcelos Logic-based test coverage Basic approach Clauses and predicates Basic coverage criteria: CC, PC, CoC Structural logic coverage of source code Logic coverage

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

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

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

Logic Coverage from Source Code

Logic Coverage from Source Code Logic Coverage from Source Code 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 Expressions from Source Predicates

More information

Logic-based test coverage

Logic-based test coverage Logic-based test coverage!!! Basic approach Clauses and predicates Basic coverage criteria: CC, PC, CoC Structural logic coverage of source code Logic coverage of specifications Active clause coverage

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

EVALUATING THE EFFECTIVENESS OF TEST COVERAGE CRITERIA USING MUTATION ANALYSIS. An evaluation of test coverage criteria in C#

EVALUATING THE EFFECTIVENESS OF TEST COVERAGE CRITERIA USING MUTATION ANALYSIS. An evaluation of test coverage criteria in C# EVALUATING THE EFFECTIVENESS OF TEST COVERAGE CRITERIA USING MUTATION ANALYSIS An evaluation of test coverage criteria in C# Examensarbete inom huvudområdet Informationsteknologi Grundnivå 30 Högskolepoäng

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

Testing: Coverage and Structural Coverage

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

More information

DRAFT: Prepublication draft, Fall 2014, George Mason University Redistribution is forbidden without the express permission of the authors

DRAFT: Prepublication draft, Fall 2014, George Mason University Redistribution is forbidden without the express permission of the authors Chapter 9 Syntax-based Testing Date last generated: September 29, 2014. DRAFT: Prepublication draft, Fall 2014, George Mason University Redistribution is forbidden without the express permission of the

More information

Model Transformation Impact on Test Artifacts: An Empirical Study

Model Transformation Impact on Test Artifacts: An Empirical Study Model Transformation Impact on Test Artifacts: An Empirical Study Anders Eriksson Informatics Research Center University of Skövde, Sweden anders.eriksson@his.se Birgitta Lindström Sten F. Andler Informatics

More information

Testing: (A Little) Logic Coverage

Testing: (A Little) Logic Coverage Testing: (A Little) Logic Coverage Testing, Quality Assurance, and Maintenance Winter 2018 Prof. Arie Gurfinkel Why Logic Coverage? MC/DC (Modified condition/decision coverage) MC/DC is required by the

More information

Advanced Software Testing Understanding Code Coverage

Advanced Software Testing Understanding Code Coverage Advanced Software Testing Understanding Code Coverage Advanced Software Testing A series of webinars, this one excerpted from Advanced Software Testing: V3, a book for technical test analysts, programmers,

More information

7. Testing and Debugging Concurrent Programs

7. Testing and Debugging Concurrent Programs 7. Testing and Debugging Concurrent Programs The purpose of testing is to find program failures => A successful test is a test that causes a program to fail. Ideally, tests are designed before the program

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

CHAPTER 5 GENERATING TEST SCENARIOS AND TEST CASES FROM AN EVENT-FLOW MODEL

CHAPTER 5 GENERATING TEST SCENARIOS AND TEST CASES FROM AN EVENT-FLOW MODEL CHAPTER 5 GENERATING TEST SCENARIOS AND TEST CASES FROM AN EVENT-FLOW MODEL 5.1 INTRODUCTION The survey presented in Chapter 1 has shown that Model based testing approach for automatic generation of test

More information

Lecture Notes on Binary Decision Diagrams

Lecture Notes on Binary Decision Diagrams Lecture Notes on Binary Decision Diagrams 15-122: Principles of Imperative Computation William Lovas Notes by Frank Pfenning Lecture 25 April 21, 2011 1 Introduction In this lecture we revisit the important

More information

MTAT : Software Testing

MTAT : Software Testing MTAT.03.159: Software Testing Lecture 03: White-Box Testing (Textbook Ch. 5) Dietmar Pfahl Spring 2016 email: dietmar.pfahl@ut.ee Lecture Chapter 5 White-box testing techniques (Lab 3) Structure of Lecture

More information

Black-Box, Functional Testing

Black-Box, Functional Testing Black-Box, Functional Testing 1 Introduction Based on the definition of what a program s specification, as opposed to its structure Does the implementation correctly implement the functionality as per

More information

Reasoning About Programs Panagiotis Manolios

Reasoning About Programs Panagiotis Manolios Reasoning About Programs Panagiotis Manolios Northeastern University March 22, 2012 Version: 58 Copyright c 2012 by Panagiotis Manolios All rights reserved. We hereby grant permission for this publication

More information

Path Testing + Coverage. Chapter 8

Path Testing + Coverage. Chapter 8 Path Testing + Coverage Chapter 8 Structural Testing n Also known as glass/white/open box testing n A software testing technique whereby explicit knowledge of the internal workings of the item being tested

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

CSC Discrete Math I, Spring Sets

CSC Discrete Math I, Spring Sets CSC 125 - Discrete Math I, Spring 2017 Sets Sets A set is well-defined, unordered collection of objects The objects in a set are called the elements, or members, of the set A set is said to contain its

More information

Computational problems. Lecture 2: Combinatorial search and optimisation problems. Computational problems. Examples. Example

Computational problems. Lecture 2: Combinatorial search and optimisation problems. Computational problems. Examples. Example Lecture 2: Combinatorial search and optimisation problems Different types of computational problems Examples of computational problems Relationships between problems Computational properties of different

More information

MITOCW watch?v=kz7jjltq9r4

MITOCW watch?v=kz7jjltq9r4 MITOCW watch?v=kz7jjltq9r4 PROFESSOR: We're going to look at the most fundamental of all mathematical data types, namely sets, and let's begin with the definitions. So informally, a set is a collection

More information

INTRODUCTION TO SOFTWARE ENGINEERING

INTRODUCTION TO SOFTWARE ENGINEERING INTRODUCTION TO SOFTWARE ENGINEERING Structural Testing d_sinnig@cs.concordia.ca Department for Computer Science and Software Engineering Introduction Testing is simple all a tester needs to do is find

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

Data types for mcrl2

Data types for mcrl2 Data types for mcrl2 Aad Mathijssen April 5, 2018 We provide a syntax for the standard data types of the mcrl2 language. This syntax is intended to be a practical mix between standard mathematical notation

More information

MTAT : Software Testing

MTAT : Software Testing MTAT.03.159: Software Testing Lecture 03: White-Box Testing (Textbook Ch. 5) Dietmar Pfahl Spring 2017 email: dietmar.pfahl@ut.ee Lecture Chapter 5 White-box testing techniques (Lab 3) Structure of Lecture

More information

CS Bootcamp Boolean Logic Autumn 2015 A B A B T T T T F F F T F F F F T T T T F T F T T F F F

CS Bootcamp Boolean Logic Autumn 2015 A B A B T T T T F F F T F F F F T T T T F T F T T F F F 1 Logical Operations 1.1 And The and operator is a binary operator, denoted as, &,, or sometimes by just concatenating symbols, is true only if both parameters are true. A B A B F T F F F F The expression

More information

Some Hardness Proofs

Some Hardness Proofs Some Hardness Proofs Magnus Lie Hetland January 2011 This is a very brief overview of some well-known hard (NP Hard and NP complete) problems, and the main ideas behind their hardness proofs. The document

More information

Selec%on and Decision Structures in Java: If Statements and Switch Statements CSC 121 Fall 2016 Howard Rosenthal

Selec%on and Decision Structures in Java: If Statements and Switch Statements CSC 121 Fall 2016 Howard Rosenthal Selec%on and Decision Structures in Java: If Statements and Switch Statements CSC 121 Fall 2016 Howard Rosenthal Lesson Goals Understand Control Structures Understand how to control the flow of a program

More information

5. Control Statements

5. Control Statements 5. Control Statements This section of the course will introduce you to the major control statements in C++. These control statements are used to specify the branching in an algorithm/recipe. Control statements

More information

CSE 20 DISCRETE MATH. Fall

CSE 20 DISCRETE MATH. Fall CSE 20 DISCRETE MATH Fall 2017 http://cseweb.ucsd.edu/classes/fa17/cse20-ab/ Final exam The final exam is Saturday December 16 11:30am-2:30pm. Lecture A will take the exam in Lecture B will take the exam

More information

Structural Testing. (c) 2007 Mauro Pezzè & Michal Young Ch 12, slide 1

Structural Testing. (c) 2007 Mauro Pezzè & Michal Young Ch 12, slide 1 Structural Testing (c) 2007 Mauro Pezzè & Michal Young Ch 12, slide 1 Learning objectives Understand rationale for structural testing How structural (code-based or glass-box) testing complements functional

More information

Chapter 3. Set Theory. 3.1 What is a Set?

Chapter 3. Set Theory. 3.1 What is a Set? Chapter 3 Set Theory 3.1 What is a Set? A set is a well-defined collection of objects called elements or members of the set. Here, well-defined means accurately and unambiguously stated or described. Any

More information

AXIOMS OF AN IMPERATIVE LANGUAGE PARTIAL CORRECTNESS WEAK AND STRONG CONDITIONS. THE AXIOM FOR nop

AXIOMS OF AN IMPERATIVE LANGUAGE PARTIAL CORRECTNESS WEAK AND STRONG CONDITIONS. THE AXIOM FOR nop AXIOMS OF AN IMPERATIVE LANGUAGE We will use the same language, with the same abstract syntax that we used for operational semantics. However, we will only be concerned with the commands, since the language

More information

Programming Languages Third Edition

Programming Languages Third Edition Programming Languages Third Edition Chapter 12 Formal Semantics Objectives Become familiar with a sample small language for the purpose of semantic specification Understand operational semantics Understand

More information

Introduction. Easy to get started, based on description of the inputs

Introduction. Easy to get started, based on description of the inputs Introduction Testing is about choosing elements from input domain. The input domain of a program consists of all possible inputs that could be taken by the program. Easy to get started, based on description

More information

MTAT : Software Testing

MTAT : Software Testing MTAT.03.159: Software Testing Lecture 02: Basic Black-Box and White-Box Testing Techniques (Textbook Ch. 4 & 5) Spring 2018 Dietmar Pfahl email: dietmar.pfahl@ut.ee Structure of Lecture 2 Black-Box vs.

More information

Reasoning About Imperative Programs. COS 441 Slides 10

Reasoning About Imperative Programs. COS 441 Slides 10 Reasoning About Imperative Programs COS 441 Slides 10 The last few weeks Agenda reasoning about functional programming It s very simple and very uniform: substitution of equal expressions for equal expressions

More information

3.7 Denotational Semantics

3.7 Denotational Semantics 3.7 Denotational Semantics Denotational semantics, also known as fixed-point semantics, associates to each programming language construct a well-defined and rigorously understood mathematical object. These

More information

CS111: PROGRAMMING LANGUAGE II

CS111: PROGRAMMING LANGUAGE II CS111: PROGRAMMING LANGUAGE II Computer Science Department Lecture 1(c): Java Basics (II) Lecture Contents Java basics (part II) Conditions Loops Methods Conditions & Branching Conditional Statements A

More information

Selec%on and Decision Structures in Java: If Statements and Switch Statements CSC 121 Spring 2016 Howard Rosenthal

Selec%on and Decision Structures in Java: If Statements and Switch Statements CSC 121 Spring 2016 Howard Rosenthal Selec%on and Decision Structures in Java: If Statements and Switch Statements CSC 121 Spring 2016 Howard Rosenthal Lesson Goals Understand Control Structures Understand how to control the flow of a program

More information

Formal Specification and Verification

Formal Specification and Verification Formal Specification and Verification Introduction to Promela Bernhard Beckert Based on a lecture by Wolfgang Ahrendt and Reiner Hähnle at Chalmers University, Göteborg Formal Specification and Verification:

More information

Programming Embedded Systems

Programming Embedded Systems Programming Embedded Systems Overview of testing techniques Monday March 3, 2014 Philipp Rümmer Uppsala University Philipp.Ruemmer@it.uu.se 1/70 Lecture outline Background, testing in general Unit testing

More information

Subject Software Testing Structural Testing

Subject Software Testing Structural Testing Subject Software Testing Structural Testing Objective: 1. Understand Concept of structural testing 2. How structural (code-based or glass-box) testing complements functional (black-box) testing 3. Recognize

More information

Lecture 10 Notes Linked Lists

Lecture 10 Notes Linked Lists Lecture 10 Notes Linked Lists 15-122: Principles of Imperative Computation (Spring 2016) Frank Pfenning, Rob Simmons, André Platzer 1 Introduction In this lecture we discuss the use of linked lists to

More information

PROCEDURAL DATABASE PROGRAMMING ( PL/SQL AND T-SQL)

PROCEDURAL DATABASE PROGRAMMING ( PL/SQL AND T-SQL) Technology & Information Management Instructor: Michael Kremer, Ph.D. Class 3 Database Programming PROCEDURAL DATABASE PROGRAMMING ( PL/SQL AND T-SQL) AGENDA 3. Declaring Variables/Constants 4. Flow Control

More information

Test Case Specifications and Test adequacy. Research Methods - Barbara Russo SwSE - Software and Systems Engineering

Test Case Specifications and Test adequacy. Research Methods - Barbara Russo SwSE - Software and Systems Engineering Test Case Specifications and Test adequacy Research Methods - Barbara Russo SwSE - Software and Systems Engineering 1 Test Case Selection How do we create tests? Test are defined in terms of their adequacy

More information

Chapter 10 Part 1: Reduction

Chapter 10 Part 1: Reduction //06 Polynomial-Time Reduction Suppose we could solve Y in polynomial-time. What else could we solve in polynomial time? don't confuse with reduces from Chapter 0 Part : Reduction Reduction. Problem X

More information

Algorithms Lecture 11. UC Davis, ECS20, Winter Discrete Mathematics for Computer Science

Algorithms Lecture 11. UC Davis, ECS20, Winter Discrete Mathematics for Computer Science UC Davis, ECS20, Winter 2017 Discrete Mathematics for Computer Science Prof. Raissa D Souza (slides adopted from Michael Frank and Haluk Bingöl) Lecture 11 Algorithms 3.1-3.2 Algorithms Member of the House

More information

Programming Embedded Systems

Programming Embedded Systems Programming Embedded Systems Lecture 8 Overview of software testing Wednesday Feb 8, 2012 Philipp Rümmer Uppsala University Philipp.Ruemmer@it.uu.se 1/53 Lecture outline Testing in general Unit testing

More information

Semantics via Syntax. f (4) = if define f (x) =2 x + 55.

Semantics via Syntax. f (4) = if define f (x) =2 x + 55. 1 Semantics via Syntax The specification of a programming language starts with its syntax. As every programmer knows, the syntax of a language comes in the shape of a variant of a BNF (Backus-Naur Form)

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

CS103 Spring 2018 Mathematical Vocabulary

CS103 Spring 2018 Mathematical Vocabulary CS103 Spring 2018 Mathematical Vocabulary You keep using that word. I do not think it means what you think it means. - Inigo Montoya, from The Princess Bride Consider the humble while loop in most programming

More information

Proofs about Programs

Proofs about Programs Proofs about Programs Program Verification (Rosen, Sections 5.5) TOPICS Program Correctness Preconditions & Postconditions Program Verification Assignment Statements Conditional Statements Loops Composition

More information

Syntax of Eiffel: a Brief Overview

Syntax of Eiffel: a Brief Overview Syntax of Eiffel: a Brief Overview EECS3311 A: Software Design Fall 2018 CHEN-WEI WANG Escape Sequences Escape sequences are special characters to be placed in your program text. In Java, an escape sequence

More information

MTAT : Software Testing

MTAT : Software Testing MTAT.03.159: Software Testing Lecture 02: Basic Black-Box and White-Box Testing Techniques (Textbook Ch. 4 & 5) Spring 2018 Dietmar Pfahl email: dietmar.pfahl@ut.ee Structure of Lecture 2 Black-Box vs.

More information

SQLite with a Fine-Toothed Comb. John Regehr Trust-in-So1 / University of Utah

SQLite with a Fine-Toothed Comb. John Regehr Trust-in-So1 / University of Utah SQLite with a Fine-Toothed Comb John Regehr Trust-in-So1 / University of Utah Feasible states for a system we care about No execu

More information

Motivation State Machines

Motivation State Machines Motivation State Machines Generating test cases for complex behaviour Textbook Reading: Chapter 7 We are interested in testing the behaviour of object-oriented software systems Behaviour: Interactions

More information

Commands, and Queries, and Features. Syntax of Eiffel: a Brief Overview. Escape Sequences. Naming Conventions

Commands, and Queries, and Features. Syntax of Eiffel: a Brief Overview. Escape Sequences. Naming Conventions Commands, and Queries, and Features Syntax of Eiffel: a Brief Overview EECS3311 A: Software Design Fall 2018 CHEN-WEI WANG In a Java class: Attributes: Data Mutators: Methods that change attributes without

More information

Software Quality Assurance Dynamic Test

Software Quality Assurance Dynamic Test Software Quality Assurance Dynamic Test Contents Properties and goals Structural testing Control flow testing Data flow testing Functional test Diversified test 2 Properties and Goals Properties of dynamic

More information

Foundations: Syntax, Semantics, and Graphs

Foundations: Syntax, Semantics, and Graphs Foundations: Syntax, Semantics, and Graphs Testing, Quality Assurance, and Maintenance Winter 2018 Prof. Arie Gurfinkel based on slides by Ruzica Pizkac, Claire Le Goues, Lin Tan, Marsha Chechik, and others

More information

4.1 Review - the DPLL procedure

4.1 Review - the DPLL procedure Applied Logic Lecture 4: Efficient SAT solving CS 4860 Spring 2009 Thursday, January 29, 2009 The main purpose of these notes is to help me organize the material that I used to teach today s lecture. They

More information

Induction and Semantics in Dafny

Induction and Semantics in Dafny 15-414 Lecture 11 1 Instructor: Matt Fredrikson Induction and Semantics in Dafny TA: Ryan Wagner Encoding the syntax of Imp Recall the abstract syntax of Imp: a AExp ::= n Z x Var a 1 + a 2 b BExp ::=

More information

Finite State Verification. CSCE Lecture 14-02/25/2016

Finite State Verification. CSCE Lecture 14-02/25/2016 Finite State Verification CSCE 747 - Lecture 14-02/25/2016 So, You Want to Perform Verification... You have a property that you want your program to obey. Great! Let s write some tests! Does testing guarantee

More information

Boolean Representations and Combinatorial Equivalence

Boolean Representations and Combinatorial Equivalence Chapter 2 Boolean Representations and Combinatorial Equivalence This chapter introduces different representations of Boolean functions. It then discusses the applications of these representations for proving

More information

SOFTWARE ENGINEERING DESIGN I

SOFTWARE ENGINEERING DESIGN I 2 SOFTWARE ENGINEERING DESIGN I 3. Schemas and Theories The aim of this course is to learn how to write formal specifications of computer systems, using classical logic. The key descriptional technique

More information

CSE 20 DISCRETE MATH. Winter

CSE 20 DISCRETE MATH. Winter CSE 20 DISCRETE MATH Winter 2017 http://cseweb.ucsd.edu/classes/wi17/cse20-ab/ Final exam The final exam is Saturday March 18 8am-11am. Lecture A will take the exam in GH 242 Lecture B will take the exam

More information

Type Checking and Type Equality

Type Checking and Type Equality Type Checking and Type Equality Type systems are the biggest point of variation across programming languages. Even languages that look similar are often greatly different when it comes to their type systems.

More information

Interaction Testing. Chapter 15

Interaction Testing. Chapter 15 Interaction Testing Chapter 15 Interaction faults and failures Subtle Difficult to detect with testing Usually seen after systems have been delivered In low probability threads Occur after a long time

More information

CS 512, Spring 2017: Take-Home End-of-Term Examination

CS 512, Spring 2017: Take-Home End-of-Term Examination CS 512, Spring 2017: Take-Home End-of-Term Examination Out: Tuesday, 9 May 2017, 12:00 noon Due: Wednesday, 10 May 2017, by 11:59 am Turn in your solutions electronically, as a single PDF file, by placing

More information

Properties of Criteria. 1. Applicability Property. Criteria

Properties of Criteria. 1. Applicability Property. Criteria Properties of Criteria Program-based To recognize a good adequacy criteria And to discard poor choices Objective, well-defined properties 1. Applicability Property For every program, there exists an adequate

More information

Design and Debug: Essen.al Concepts CS 16: Solving Problems with Computers I Lecture #8

Design and Debug: Essen.al Concepts CS 16: Solving Problems with Computers I Lecture #8 Design and Debug: Essen.al Concepts CS 16: Solving Problems with Computers I Lecture #8 Ziad Matni Dept. of Computer Science, UCSB Outline Midterm# 1 Grades Review of key concepts Loop design help Ch.

More information

Chapter 3. Selections

Chapter 3. Selections Chapter 3 Selections 1 Outline 1. Flow of Control 2. Conditional Statements 3. The if Statement 4. The if-else Statement 5. The Conditional operator 6. The Switch Statement 7. Useful Hints 2 1. Flow of

More information

The Effectiveness of Test Coverage Criteria for Relational Database Schema Integrity Constraints

The Effectiveness of Test Coverage Criteria for Relational Database Schema Integrity Constraints The Effectiveness of Test Coverage Criteria for Relational Database Schema Integrity Constraints PHIL MCMINN and CHRIS J. WRIGHT, University of Sheffield GREGORY M. KAPFHAMMER, Allegheny College Despite

More information

Safe Stratified Datalog With Integer Order Does not Have Syntax

Safe Stratified Datalog With Integer Order Does not Have Syntax Safe Stratified Datalog With Integer Order Does not Have Syntax Alexei P. Stolboushkin Department of Mathematics UCLA Los Angeles, CA 90024-1555 aps@math.ucla.edu Michael A. Taitslin Department of Computer

More information

Recursively Enumerable Languages, Turing Machines, and Decidability

Recursively Enumerable Languages, Turing Machines, and Decidability Recursively Enumerable Languages, Turing Machines, and Decidability 1 Problem Reduction: Basic Concepts and Analogies The concept of problem reduction is simple at a high level. You simply take an algorithm

More information

(Not Quite) Minijava

(Not Quite) Minijava (Not Quite) Minijava CMCS22620, Spring 2004 April 5, 2004 1 Syntax program mainclass classdecl mainclass class identifier { public static void main ( String [] identifier ) block } classdecl class identifier

More information