129
Graph Coverage CMPT 473 Soſtware Quality Assurance Nick Sumner

CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

Graph Coverage

CMPT 473Software Quality Assurance

Nick Sumner

Page 2: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

2

Recall: Coverage/Adequacy

● Can't look at all possible inputs.● Need to determine if a test suite covers / is

adequate for our quality objectives.

Page 3: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

3

Recall: Coverage/Adequacy

● Can't look at all possible inputs.● Need to determine if a test suite covers / is

adequate for our quality objectives.● So far: Input & Requirements based

Page 4: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

4

Recall: Coverage/Adequacy

● Can't look at all possible inputs.● Need to determine if a test suite covers / is

adequate for our quality objectives.● So far: Input & Requirements based

Efficiently sort a provided list in under X seconds

void sortEfficiently(List list) { if (list.size() < THRESHOLD) { sort1(list); } else { sort2(list); }}

Page 5: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

5

Recall: Coverage/Adequacy

● Can't look at all possible inputs.● Need to determine if a test suite covers / is

adequate for our quality objectives.● So far: Input & Requirements based

void sortEfficiently(List list) { if (list.size() < THRESHOLD) { sort1(list); } else { sort2(list); }}

How well can input basedtechniques test this?

Efficiently sort a provided list in under X seconds

Page 6: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

6

Recall: Coverage/Adequacy

● Can't look at all possible inputs.● Need to determine if a test suite covers / is

adequate for our quality objectives.● So far: Input & Requirements based

void sortEfficiently(List list) { if (list.size() < THRESHOLD) { sort1(list); } else { sort2(list); }}

How might we do better?

Efficiently sort a provided list in under X seconds

How well can input basedtechniques test this?

Page 7: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

7

White Box / Black Blox

● Considering only the requirements or input is a black box approach– Treats the program like an opaque box– No deep knowledge of the program's structure

Page 8: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

8

White Box / Black Blox

● Considering only the requirements or input is a black box approach– Treats the program like an opaque box– No deep knowledge of the program's structure

● Techniques that use artifacts of the program structure are white box approaches– They can 'see into' the program's implementation

Page 9: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

9

White Box Testing

● What is a simple approach that solves our problem here?

void sortEfficiently(List list) { if (list.size() < THRESHOLD) { sort1(list); } else { sort2(list); }}

Page 10: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

10

White Box Testing

● What is a simple approach that solves our problem here?

● Statement Coverage– How many of the statements did the suite test?

void sortEfficiently(List list) { if (list.size() < THRESHOLD) { sort1(list); } else { sort2(list); }}

Page 11: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

11

White Box Testing

● What is a simple approach that solves our problem here?

● Statement Coverage– How many of the statements did the suite test?

● Branch Coverage– How many of the condition outcomes were tested?

void sortEfficiently(List list) { if (list.size() < THRESHOLD) { sort1(list); } else { sort2(list); }}

Page 12: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

12

White Box Testing

● In this course, we'll mostly look at graph coverage based techniques

Page 13: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

13

White Box Testing

● In this course, we'll mostly look at graph coverage based techniques– Most commonly used metrics in the real world

Page 14: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

14

White Box Testing

● In this course, we'll mostly look at graph coverage based techniques– Most commonly used metrics in the real world– Most concepts can be modeled through graphs

e.g. programs, protocols, use patterns, designs, ...

So a bit of review...

Page 15: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

15

Graphs

● What is a graph G?

Page 16: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

16

Graphs

● What is a graph G?– A set N of nodes

B A

DEC

Page 17: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

17

Graphs

● What is a graph G?– A set N of nodes– A set E of edges

B A

DEC

Page 18: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

18

Graphs

● What is a graph G?– A set N of nodes– A set E of edges

● When edges are directed from one node to another, the graph is a directed graph

B A

DEC

Page 19: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

19

Graphs

● What is a graph G?– A set N of nodes– A set E of edges

● When edges are directed from one node to another, the graph is a directed graph

● A path is a list of pairwise connected nodes

B A

DEC

Page 20: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

20

Graphs

● What is a graph G?– A set N of nodes– A set E of edges

● When edges are directed from one node to another, the graph is a directed graph

● A path is a list of pairwise connected nodes

B A

DEC

ABCDE

Page 21: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

21

Graphs

● What is a graph G?– A set N of nodes– A set E of edges

● When edges are directed from one node to another, the graph is a directed graph

● A path is a list of pairwise connected nodes

B A

DEC

ABCDEABDEAEBCDEBD

Page 22: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

22

Control Flow Graphs (CFGs)

● Programs can be modeled as graphs– Used extensively in compilers

Page 23: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

23

Control Flow Graphs (CFGs)

● Programs can be modeled as graphs– Used extensively in compilers– Also used in testing!

Page 24: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

24

Control Flow Graphs (CFGs)

● Programs can be modeled as graphs– Used extensively in compilers– Also used in testing!

● Control Flow Graphs– Nodes comprise the code of a program

Page 25: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

25

Control Flow Graphs (CFGs)

● Programs can be modeled as graphs– Used extensively in compilers– Also used in testing!

● Control Flow Graphs– Nodes comprise the code of a program– Edges show the paths that an execution may take

through a program

Page 26: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

26

Control Flow Graphs

Example:void sortEfficiently(List list) { if (list.size() < THRESHOLD) { sort1(list); } else { sort2(list); }}

Page 27: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

27

Control Flow Graphs

Example:void sortEfficiently(List list) { if (list.size() < THRESHOLD) { sort1(list); } else { sort2(list); }}

if (list.size() < THRESHOLD)

sort1(list); sort2(list);

return;

Page 28: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

28

Control Flow Graphs

Example:void sortEfficiently(List list) { if (list.size() < THRESHOLD) { sort1(list); } else { sort2(list); }}

if (list.size() < THRESHOLD)

sort1(list); sort2(list);

return;

Page 29: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

29

Control Flow Graphs

Example:void sortEfficiently(List list) { if (list.size() < THRESHOLD) { sort1(list); } else { sort2(list); }}

if (list.size() < THRESHOLD)

sort1(list); sort2(list);

return;

size < THRESHOLD size >= THRESHOLD

Page 30: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

30

Control Flow Graphs

Example:void sortEfficiently(List list) { if (list.size() < THRESHOLD) { sort1(list); } else { sort2(list); }}

if (list.size() < THRESHOLD)

sort1(list); sort2(list);

return;

size < THRESHOLD size >= THRESHOLD

Page 31: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

31

Control Flow Graphs

● Many types of nodes:

if (list.size() < THRESHOLD)

sort1(list); sort2(list);

print(list);

list = ...

return;

size < THRESHOLD size >= THRESHOLD

Page 32: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

32

Control Flow Graphs

● Many types of nodes:

if (list.size() < THRESHOLD)

sort1(list); sort2(list);

print(list);

Entry Node

list = ...

return;

0 incoming edges

size < THRESHOLD size >= THRESHOLD

Page 33: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

33

Control Flow Graphs

● Many types of nodes:

if (list.size() < THRESHOLD)

sort1(list); sort2(list);

print(list);

Entry Node

list = ...

return;

0 incoming edges

Exit Node0 outgoing

edges

size < THRESHOLD size >= THRESHOLD

Page 34: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

34

Control Flow Graphs

● Many types of nodes:

if (list.size() < THRESHOLD)

sort1(list); sort2(list);

print(list);

Entry Node

>1 outgoing edges

list = ...Decision/Branch Node

return;

0 incoming edges

Exit Node0 outgoing

edges

size < THRESHOLD size >= THRESHOLD

Page 35: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

35

Control Flow Graphs

● Many types of nodes:

if (list.size() < THRESHOLD)

sort1(list); sort2(list);

print(list);

Entry Node

list = ...

return;

0 incoming edges

Exit Node0 outgoing

edges

>1 incoming edges

Join Node

size < THRESHOLD size >= THRESHOLD

Decision/Branch Node>1 outgoing

edges

Page 36: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

36

Control Flow Graphs

● Straight-line sequences of code are grouped into basic blocks:

if (list.size() < THRESHOLD)

sort1(list); sort2(list);

print(list);

list = ...

return;

size < THRESHOLD size >= THRESHOLD

Page 37: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

37

Control Flow Graphs

● Straight-line sequences of code are grouped into basic blocks:

list = ...if (list.size() < THRESHOLD)

sort1(list); sort2(list);

print(list);return;

size < THRESHOLD size >= THRESHOLD

Page 38: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

38

Control Flow Graphs

● Many patterns arise from common constructs

Page 39: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

39

Control Flow Graphs

q = 0;r = x;while r >= y { r = r - y; q = q + 1;}

● Many patterns arise from common constructs● What is the CFG for this program?

Tell me how to draw it.

Page 40: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

40

Control Flow Graphs

for (i = 0; i < n; i++) { foo(i);}

● What is the CFG?

Page 41: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

41

Control Flow Graphs

switch (x) { case a: foo(x); break; case b: bar(x); case c: baz(x); break;}

● What is the CFG?– Don't forget implicit behavior like default!

Page 42: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

42

Control Flow Graphs

if (x == 0 || y/x > 1) { foo(x, y);}

● What is the CFG?– Short circuit operators can lead to subtle behavior!

Page 43: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

43

Control Flow Graphs

● What is the CFG?– Control flow can become complex!

From Ammann & Offutt:

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

Page 44: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

44

Control Flow Graphs

● What is the CFG?– Control flow can become complex!

From Ammann & Offutt:

123456789101112

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

Page 45: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

45

Control Flow Graphs

● What is the CFG?– Control flow can become complex!

From Ammann & Offutt:

1234

6

7

10

12

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

Page 46: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

46

Control Flow Graphs

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

● What is the CFG?– Control flow can become complex!

From Ammann & Offutt:

1234

6

7

10

12

Page 47: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

47

Control Flow Graphs

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

● What is the CFG?– Control flow can become complex!

From Ammann & Offutt:

1234

6

7

10

12

Page 48: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

48

Control Flow Graphs

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

● What is the CFG?– Control flow can become complex!

From Ammann & Offutt:

1234

6

7

10

12

Page 49: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

49

Control Flow Graphs

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

● What is the CFG?– Control flow can become complex!

From Ammann & Offutt:

1234

6

7

10

12

Page 50: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

50

Control Flow Graphs

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

● What is the CFG?– Control flow can become complex!

From Ammann & Offutt:

1234

6

7

10

12

Page 51: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

51

Control Flow Graphs

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

● What is the CFG?– Control flow can become complex!

From Ammann & Offutt:

1234

6

7

10

12

Page 52: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

52

Control Flow Graphs

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

● What is the CFG?– Control flow can become complex!

From Ammann & Offutt:

1234

6

7

10

12

Page 53: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

53

CFG Coverage

● Statement Coverage → Node Coverage

Try to cover all reachable basic blocks.

Page 54: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

54

CFG Coverage

● Statement Coverage → Node Coverage

Thinking in terms of node coveragecan be more efficient. Why?

Page 55: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

55

CFG Coverage

● Statement Coverage → Node Coverage● Branch Coverage → Edge Coverage

Try to cover all reachable paths of length ≤ 1.

Page 56: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

56

CFG Coverage

● Statement Coverage → Node Coverage● Branch Coverage → Edge Coverage

How do node & edge coveragecompare? Why?

Page 57: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

57

CFG Coverage

● Statement Coverage → Node Coverage● Branch Coverage → Edge Coverage

Are these notions of coverageenough? Why?

How do node & edge coveragecompare? Why?

Page 58: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

58

Pragmatic Concerns

● The goal is full coverage (of whatever criteria)

Page 59: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

59

Pragmatic Concerns

● The goal is full coverage (of whatever criteria)

Is that reasonable in practice?Why?

Page 60: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

60

Pragmatic Concerns

● The goal is full coverage (of whatever criteria)● We must consider reachability

Page 61: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

61

Pragmatic Concerns

● The goal is full coverage (of whatever criteria)● We must consider reachability

Try to cover all reachable basic blocks.

Try to cover all reachable paths of length ≤ 1.

Page 62: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

62

Pragmatic Concerns

● The goal is full coverage (of whatever criteria)● We must consider reachability

– Syntactic Reachability● Based on the structure of the code

ENTER

...

return;

print(“Got Here”)

return;

Page 63: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

63

Pragmatic Concerns

● The goal is full coverage (of whatever criteria)● We must consider reachability

– Syntactic Reachability● Based on the structure of the code

ENTER

...

return;

print(“Got Here”)

return;

How could this happen?

Page 64: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

64

Pragmatic Concerns

● The goal is full coverage (of whatever criteria)● We must consider reachability

– Syntactic Reachability● Based on the structure of the code

– Semantic Reachability● Based on the meaning of the code

condition = false;if (condition)

... ...

return;

Page 65: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

65

Pragmatic Concerns

● The goal is full coverage (of whatever criteria)● We must consider reachability

– Syntactic Reachability● Based on the structure of the code

– Semantic Reachability● Based on the meaning of the code

condition = false;if (condition)

... ...

return;

This can beundecidable!

Page 66: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

66

Pragmatic Concerns

● The goal is full coverage (of whatever criteria)● We must consider reachability

– Syntactic Reachability● Based on the structure of the code

– Semantic Reachability● Based on the meaning of the code

● So what do you do in practice?– No, really. What have you done in practice?

Page 67: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

67

Pragmatic Concerns

● The goal is full coverage (of whatever criteria)● We must consider reachability

– Syntactic Reachability● Based on the structure of the code

– Semantic Reachability● Based on the meaning of the code

● So what do you do in practice?– No, really. What have you done in practice?– Relative degrees of coverage matter (40%? 80%?)

Page 68: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

68

CFG Coverage

● The path taken by each test can matter

if (condition 1)

... x = 0;

if (condition2)

... z = y/x;

return;

Page 69: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

69

CFG Coverage

● The path taken by each test can matter

if (condition 1)

... x = 0;

if (condition2)

... z = y/x;

return;

Page 70: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

70

CFG Coverage

● The path taken by each test can matter

if (condition 1)

... x = 0;

if (condition2)

... z = y/x;

return;

Page 71: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

71

CFG Coverage

● The path taken by each test can matter

if (condition 1)

... x = 0;

if (condition2)

... z = y/x;

return;

Full edge coverage& no bugs found

Page 72: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

72

CFG Coverage

● The path taken by each test can matter

if (condition 1)

... x = 0;

if (condition2)

... z = y/x;

return;

How can we make sure to find this bug?

Page 73: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

73

CFG Coverage

● The path taken by each test can matter

if (condition 1)

... x = 0;

if (condition2)

... z = y/x;

return;

Page 74: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

74

CFG Coverage

● The path taken by each test can matter

if (condition 1)

... x = 0;

if (condition2)

... z = y/x;

return;

Page 75: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

75

CFG Coverage

● The path taken by each test can matter

if (condition 1)

... x = 0;

if (condition2)

... z = y/x;

return;

Testing all pathsexposes this bug.

Page 76: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

76

Path Coverage

● Complete Path Coverage– Test all paths through the graph

Page 77: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

77

Path Coverage

● Complete Path Coverage– Test all paths through the graph

Is this reasonable?Why?

Page 78: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

78

Path Coverage

● Complete Path Coverage– Test all paths through the graph

B

CD

A

Is this reasonable?Why?

Page 79: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

79

Path Coverage

● Complete Path Coverage– Test all paths through the graph

B

CD

A

Infeasibility

Is this reasonable?Why?

Page 80: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

80

Path Coverage

● Complete Path Coverage– Test all paths through the graph

B

CD

A

Infeasibility

How many paths?How does this relate to input

based approaches?

A

CB

D

FE

G

H

JI

K

... ...

Is this reasonable?Why?

Page 81: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

81

Path Coverage

● Complete Path Coverage– Test all paths through the graph

B

CD

A

Infeasibility

A

CB

D

FE

G

H

JI

K

... ... Intractability

Is this reasonable?Why?

How many paths?How does this relate to input

based approaches?

Page 82: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

82

Compromises?

● What could we do instead?(How did we handle the input based approaches?)

Page 83: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

83

Compromises?

● Edge Pair Coverage– Each path of length <= 2 is tested.

● Specified Path Coverage– Given a number k, test k paths

Page 84: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

84

Compromises?

● Edge Pair Coverage– Each path of length <= 2 is tested.

● Specified Path Coverage– Given a number k, test k paths

A

CB

D

FE

G

H

JI

K

... ...

B

CD

A

What do these look like?

Page 85: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

85

Compromises?

● Edge Pair Coverage– Each path of length <= 2 is tested.

● Specified Path Coverage– Given a number k, test k paths

A

CB

D

FE

G

H

JI

K

... ...

B

CD

A

What do these look like?

Are they good?

Page 86: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

86

Coping With Loops

● What criteria do you use when testing loops?

Page 87: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

87

Coping With Loops

● What criteria do you use when testing loops?● Simple Paths

– A path between nodes is simple if no node appears more than once. (Except maybe the first and last)

– Captures the acyclic behaviors of a program

Page 88: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

88

Coping With Loops

● What criteria do you use when testing loops?● Simple Paths

– A path between nodes is simple if no node appears more than once. (Except maybe the first and last)

– Captures the acyclic behaviors of a program

How many may there be?

A

B C

D

Page 89: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

89

Coping With Loops

● What criteria do you use when testing loops?● Simple Paths

– A path between nodes is simple if no node appears more than once. (Except maybe the first and last)

– Captures the acyclic behaviors of a program

How many may there be?

A

B C

D

Page 90: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

90

Coping With Loops

● What criteria do you use when testing loops?● Simple Paths

– A path between nodes is simple if no node appears more than once. (Except maybe the first and last)

– Captures the acyclic behaviors of a program

How many may there be?

A

B C

D

Page 91: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

91

Coping With Loops

● What criteria do you use when testing loops?● Simple Paths

– A path between nodes is simple if no node appears more than once. (Except maybe the first and last)

– Captures the acyclic behaviors of a program● Prime Paths

– A simple path that is not a subpath of any other simple path

Page 92: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

92

Coping With Loops

● What criteria do you use when testing loops?● Simple Paths

– A path between nodes is simple if no node appears more than once. (Except maybe the first and last)

– Captures the acyclic behaviors of a program● Prime Paths

– A simple path that is not a subpath of any other simple path

What does this provide?What do they look like?

A

B C

D

Page 93: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

93

Coping With Loops

● Prime Path Coverage– Cover all prime paths

Page 94: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

94

Coping With Loops

● Prime Path Coverage– Cover all prime paths

A

G

B

C

ED

F

Example from Ammann & Offutt

Page 95: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

95

Coping With Loops

● Prime Path Coverage– Cover all prime paths

A

G

B

C

ED

F

Example from Ammann & Offutt

What are the prime paths?

Page 96: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

96

Coping With Loops

● Prime Path Coverage– Cover all prime paths

A

G

B

C

ED

F

Example from Ammann & Offutt

What are the prime paths?

How many simple paths?

Page 97: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

97

Coping With Loops

● Prime Path Coverage– Cover all prime paths

A

G

B

C

ED

F

Example from Ammann & Offutt

What are the prime paths?

How many simple paths?

Can you intuitively explain what prime paths capture?

Page 98: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

98

Coping With Loops

● Prime Path Coverage– Cover all prime paths

Are these tests good or bad?

Page 99: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

99

Coping With Loops

● Prime Path Coverage– Cover all prime paths

Are these tests good or bad?

Do they address all of the problems with path coverage?

Page 100: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

100

Coping With Loops

● Prime Path Coverage– Cover all prime paths

Are these tests good or bad?

Do they address all of the problems with path coverage?

Can you think of things they miss?

Page 101: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

101

How Do They Relate?All / Complete Path Coverage

How do they compare w/ edge coverage?

Prime Path Coverage

Page 102: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

102

How Do They Relate?All / Complete Path Coverage

Prime Path Coverage

Edge Coverage

Node Coverage

Page 103: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

103

How Do They Relate?All / Complete Path Coverage

Prime Path Coverage

Edge Coverage

Node Coverage

How do the compare w/ edge pair coverage?

Page 104: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

104

How Do They Relate?All / Complete Path Coverage

Prime Path CoverageEdge Pair Coverage

Edge Coverage

Node Coverage

Page 105: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

105

How Do They Relate?All / Complete Path Coverage

Prime Path CoverageEdge Pair Coverage

Edge Coverage

Node Coverage

Consider:

A

B

Page 106: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

106

How Do They Relate?All / Complete Path Coverage

Prime Path CoverageEdge Pair Coverage

Edge Coverage

Node Coverage

Why did we look at prime paths at all?

Page 107: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

107

How Do They Relate?All / Complete Path Coverage

Prime Path CoverageEdge Pair Coverage

Edge Coverage

Node Coverage

Why did we look at prime paths at all?

So let's only consider loops....

Page 108: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

108

How Do They Relate?All / Complete Path Coverage

Prime Path CoverageEdge Pair Coverage

Edge Coverage

Node Coverage

Complete RoundTrip Coverage

Simple RoundTrip Coverage

Round Trip – A prime path starting and ending with the same node

Page 109: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

109

How Do They Relate?All / Complete Path Coverage

Prime Path CoverageEdge Pair Coverage

Edge Coverage

Node Coverage

Complete RoundTrip Coverage

All round trips for each node

Page 110: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

110

How Do They Relate?All / Complete Path Coverage

Prime Path CoverageEdge Pair Coverage

Edge Coverage

Node Coverage

Complete RoundTrip Coverage

Simple RoundTrip Coverage

Just one round trip for each node

Page 111: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

111

Turning Them Into Tests

● Reconsider:

A

G

B

C

ED

F

Page 112: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

112

Turning Them Into Tests

● Reconsider:

A

G

B

C

ED

F

Is this path prime?

Page 113: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

113

Turning Them Into Tests

● Reconsider:

A

G

B

C

ED

F

Is this path prime?

Is it still useful?

Page 114: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

114

Turning Them Into Tests

● Reconsider:

A

G

B

C

ED

F

Is this path prime?

Is it still useful?

One test may cover multiple prime paths!Requirements ≠ Tests

Page 115: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

115

Turning Them Into Tests

● Relaxing our path requirements can help, too

Page 116: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

116

Turning Them Into Tests

● Relaxing our path requirements can help, too● Tour

– A path p tours path q if q is a subpath of p– A test covers any prime path it tours

Page 117: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

117

Turning Them Into Tests

● Relaxing our path requirements can help, too● Tour

– A path p tours path q if q is a subpath of p– A test covers any prime path it tours

This is strict!Can we relax it?

Page 118: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

118

Turning Them Into Tests

● Relaxing our path requirements can help, too● Tour

– A path p tours path q if q is a subpath of p– A test covers any prime path it tours

● Tour with sidetrips– Iff every edge of q appears in the same order in p– “Return to where you left”

Page 119: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

119

Turning Them Into Tests

● Relaxing our path requirements can help, too● Tour

– A path p tours path q if q is a subpath of p– A test covers any prime path it tours

● Tour with sidetrips– Iff every edge of q appears in the same order in p– “Return to where you left”

● Tour with detours– Iff every node of q appears in the same order in p

Page 120: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

120

Turning Them Into Tests

A B C D E

FStrict Tour: ABCDE

Page 121: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

121

Turning Them Into Tests

A B C D E

FStrict Tour: ABCDE

Page 122: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

122

Turning Them Into Tests

A B C D E

FStrict Tour: ABCDE

A B C D E

FWith Sidetrips?

Page 123: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

123

Turning Them Into Tests

A B C D E

FStrict Tour: ABCDE

A B C D E

FWith Sidetrips?

Page 124: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

124

Turning Them Into Tests

A B C D E

FStrict Tour: ABCDE

A B C D E

FWith Sidetrips?

A B C D E

FWith Detours?

Page 125: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

125

Turning Them Into Tests

A B C D E

FStrict Tour: ABCDE

A B C D E

FWith Sidetrips?

A B C D E

FWith Detours?

Page 126: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

126

Turning Them Into Tests

● Do these relaxations help us with problems we have seen?

Page 127: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

127

Turning Them Into Tests

● Do these relaxations help us with problems we have seen?

● Can you see any problems they may introduce?

Page 128: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

128

Turning Them Into Tests

● Do these relaxations help us with problems we have seen?

● Can you see any problems they may introduce?● How might this affect how you use them?

Page 129: CMPT 473 Software Quality Assurance Graph Coveragewsumner/teaching/473/06-graphcoverage.pdf · Recall: Coverage/Adequacy ... – Nodes comprise the code of a program. 25 Control Flow

129

Onward

● But sometimes the structure of the CFG is not enough...