Presentation is loading. Please wait.

Presentation is loading. Please wait.

ECE453/SE465 Prof. Alencar University of Waterloo 1 Data Flow Testing Slice-Based Testing Winter 2007 Based on the tutorials by Prof. Kontogiannis, Winter.

Similar presentations


Presentation on theme: "ECE453/SE465 Prof. Alencar University of Waterloo 1 Data Flow Testing Slice-Based Testing Winter 2007 Based on the tutorials by Prof. Kontogiannis, Winter."— Presentation transcript:

1 ECE453/SE465 Prof. Alencar University of Waterloo 1 Data Flow Testing Slice-Based Testing Winter 2007 Based on the tutorials by Prof. Kontogiannis, Winter 2006 Presented by Akhilesh Kumar, Aleh Smalyanau a5kumar@vlsi.uwaterloo.caa5kumar@vlsi.uwaterloo.ca, aleh.smalyanau@gmail.com

2 ECE453/SE465 2University of Waterloo Agenda Slice-Based Testing Definitions Slice-Based Testing Definitions Slice-Based Testing Examples Slice-Based Testing Examples

3 ECE453/SE465 3University of Waterloo Agenda  Slice-Based Testing Definitions Slice-Based Testing Examples Slice-Based Testing Examples

4 ECE453/SE465 4University of Waterloo Slice-Based Testing Definitions Given a program P, and a program graph G(P) in which statements and statement fragments are numbered, and a set V of variables in P, the slice on the variable set V at statement fragment n, written S(V,n), is the set node numbers of all statement fragments in P prior to n that contribute to the values of variables in V at statement fragment n Given a program P, and a program graph G(P) in which statements and statement fragments are numbered, and a set V of variables in P, the slice on the variable set V at statement fragment n, written S(V,n), is the set node numbers of all statement fragments in P prior to n that contribute to the values of variables in V at statement fragment n The idea of slices is to separate a program into components that have some useful meaning The idea of slices is to separate a program into components that have some useful meaning

5 ECE453/SE465 5University of Waterloo Slice-Based Testing Definitions We will include CONST declarations in slices We will include CONST declarations in slices Five forms of usage nodes Five forms of usage nodes P-use (used in a predicate (decision)) P-use (used in a predicate (decision)) C-use (used in computation) C-use (used in computation) O-use (used for output, e.g. writeln()) O-use (used for output, e.g. writeln()) L-use (used for location, e.g. pointers) L-use (used for location, e.g. pointers) I-use (iteration, e.g. internal counters) I-use (iteration, e.g. internal counters) Two forms of definition nodes Two forms of definition nodes I-def (defined by input, e.g. readln()) I-def (defined by input, e.g. readln()) A-def (defined by assignment) A-def (defined by assignment) For now, we presume that the slice S(V,n) is a slice on one variable, that is, the set V consists of a single variable, v For now, we presume that the slice S(V,n) is a slice on one variable, that is, the set V consists of a single variable, v

6 ECE453/SE465 6University of Waterloo Slice-Based Testing Definitions If statement fragment n (in S(V,n)) is a defining node for v, then n is included in the slice If statement fragment n (in S(V,n)) is a defining node for v, then n is included in the slice If statement fragment n (in S(V,n)) is a usage node for v, then n is not included in the slice If statement fragment n (in S(V,n)) is a usage node for v, then n is not included in the slice P-uses and C-uses of other variables are included to the extent that their execution affects the value of the variable v P-uses and C-uses of other variables are included to the extent that their execution affects the value of the variable v O-use, L-use, and I-use nodes are excluded from slices O-use, L-use, and I-use nodes are excluded from slices Consider making slices compilable Consider making slices compilable

7 ECE453/SE465 7University of Waterloo Agenda Slice-Based Testing Definitions Slice-Based Testing Definitions  Slice-Based Testing Examples

8 ECE453/SE465 8University of Waterloo Slice-Based Testing Examples Find the following program slices Find the following program slices S(commission,48) S(commission,48) S(commission,40) S(commission,40) S(commission,39) S(commission,39) S(commission,38) S(commission,38) S(sales,35) S(sales,35) S(num_locks,34) S(num_locks,34) S(num_stocks,34) S(num_stocks,34) S(num_barrels,34) S(num_barrels,34)

9 ECE453/SE465 9University of Waterloo Slice-Based Testing Examples S(commission,48) S(commission,48) {1-5,8-11,13,14, 19-30,36,47,48,53} {1-5,8-11,13,14, 19-30,36,47,48,53} S(commission,40), S(commission,39), S(commission,38) S(commission,40), S(commission,39), S(commission,38) {Ø} {Ø} S(sales,35) S(sales,35) {Ø} {Ø}

10 ECE453/SE465 10University of Waterloo Slice-Based Testing Examples S(num_locks,34) S(num_locks,34) {1,8,9,10,13,14,19, 22,23,24,26,29,30, 53} {1,8,9,10,13,14,19, 22,23,24,26,29,30, 53}

11 ECE453/SE465 11University of Waterloo Slice-Based Testing Examples S(num_stocks,34) S(num_stocks,34) {1,8,9,10,13,14,20, 22-25,27,29,30,53} {1,8,9,10,13,14,20, 22-25,27,29,30,53}

12 ECE453/SE465 12University of Waterloo Slice-Based Testing Examples S(num_barrels,34) S(num_barrels,34) {1,8,9,10,13,14, 21- 25,28,29,30,53} {1,8,9,10,13,14, 21- 25,28,29,30,53}

13 ECE453/SE465 13University of Waterloo Slice-Based Testing Examples Find the program slice on FinalUse(low). Use the Program Dependency Graph approach Find the program slice on FinalUse(low). Use the Program Dependency Graph approach int binSearch(int x, int v[], int n) { {1} int low = 0; {2} int high = n – 1; {3} int mid; {4} while (low <= high) { {5} mid = (low + high) / 2; {6} mid = (low + high) / 2; {6} if (x < v[mid]) {7} if (x < v[mid]) {7} high = mid – 1; {8} else if (x > v[mid]) {9} else if (x > v[mid]) {9} low = mid + 1; {10} else {11} else {11} return mid; {12} } {13} return -1; {14} } {15}

14 ECE453/SE465 14University of Waterloo Slice-Based Testing Examples Program Dependency Graph

15 ECE453/SE465 15University of Waterloo Slice-Based Testing Examples Slice based on the criterion FinalUse(low)

16 ECE453/SE465 16University of Waterloo Slice-Based Testing Examples int binSearch(int x, int v[], int n) { {1} int low = 0; {2} int high = n – 1; {3} int mid; {4} while (low <= high) { {5} mid = (low + high) / 2; {6} mid = (low + high) / 2; {6} if (x < v[mid]) {7} if (x < v[mid]) {7} high = mid – 1; {8} else if (x > v[mid]) {9} else if (x > v[mid]) {9} low = mid + 1; {10} else {11} else {11} return mid; {12} } {13} return -1; {14} } {15} int binSearch(int x, int v[], int n) { {1} int low = 0; {2} int high = n – 1; {3} int mid; {4} while (low <= high) { {5} mid = (low + high) / 2; {6} mid = (low + high) / 2; {6} if (x < v[mid]) {7} if (x < v[mid]) {7} high = mid – 1; {8} else if (x > v[mid]) {9} else if (x > v[mid]) {9} low = mid + 1; {10} } {13} } {15} → Slice on FinalUse(low)

17 ECE453/SE465 17University of Waterloo Agenda Slice-Based Testing Definitions Slice-Based Testing Definitions Slice-Based Testing Examples Slice-Based Testing Examples

18 ECE453/SE465 18University of Waterloo References Software Testing A Craftsman's Approach 2nd edition, Paul C. Jorgensen, CRC Press (Chapter 10 (10.2)) Software Testing A Craftsman's Approach 2nd edition, Paul C. Jorgensen, CRC Press (Chapter 10 (10.2))


Download ppt "ECE453/SE465 Prof. Alencar University of Waterloo 1 Data Flow Testing Slice-Based Testing Winter 2007 Based on the tutorials by Prof. Kontogiannis, Winter."

Similar presentations


Ads by Google