0 оценок0% нашли этот документ полезным (0 голосов)
137 просмотров5 страниц
Slices are simpler than the original program and simplify the process of testing of the program. All statements where variables are defined and redefined should be considered. A slice is an executable program. S(v,n) is called slicing criteria.
Slices are simpler than the original program and simplify the process of testing of the program. All statements where variables are defined and redefined should be considered. A slice is an executable program. S(v,n) is called slicing criteria.
Авторское право:
Attribution Non-Commercial (BY-NC)
Доступные форматы
Скачайте в формате PDF, TXT или читайте онлайн в Scribd
Slices are simpler than the original program and simplify the process of testing of the program. All statements where variables are defined and redefined should be considered. A slice is an executable program. S(v,n) is called slicing criteria.
Авторское право:
Attribution Non-Commercial (BY-NC)
Доступные форматы
Скачайте в формате PDF, TXT или читайте онлайн в Scribd
STRUCTURAL TESTING variable v, or set of variables, at statement n yields the portions of the program that contributed to the value of v just before statement n is executed.
� S(v,n) is called slicing criteria.
� Slice is an executable program. Slice Based Testing
Slice Based Testing Slice Based Testing
� Introduced by Mark Weiser. GUIDELINES FOR SLICING � Prepares various subsets �All statements where variables are defined and (called slices) of program with redefined should be considered. respect to its variables and �All statements where variables are receiving their selected locations in the values externally should be considered. program. �All statements where output of a variable is printed � Slices are simpler than the should be considered. original program and simplify the process of testing of the program. Slice Based Testing Slice Based Testing GUIDELINES FOR SLICING S(c,5) S(c,3) �All the statements where relevant output is printed 1. a=3; 2. b=6; should be considered. 2. b=6; 3. c=b2; �The status of all variables may be considered at 5. c=a+b; last statement of the program.
Slice Based Testing Slice Based Testing
Consider the following portion of a program: Consider the following program. Create slices based on slicing criterion. 1. void main() 1.a=3; 2. { 3. int a,b,c,d,e; 2.b=6; 4. printf(Enter the values of a,b, and c\n); 3.c=b2; 5. scanf(%d %d %d,&a,&b,&c); 6. d=a+b; 4.d=a2+b2; 7. e=b+c; 5.c=a+b; 8. printf(%d,d); 9. printf(%d,e); 10.} Slice Based Testing Slice Based Testing 1. S(A,6)=(1,2,3,4,5,6,28) Consider the program to find largest number 2. S(A, 13)=(1,2,3,4,5,6,7,8,9,10,11,12,13,14,18,27,28) amongst three numbers. Create slices on the variables and generate test cases. 3. S(A, 28)=(1,2,3,4,5,6,7,8,9,10,11,12,13,14,18,27,28) 4. S(B, 8)=(1,2,3,4,7,8,28) 5. S(B, 24)=(1,2,3,4,5,6,7,8,9,10,11,19,20,23,24,25,26,27,28) 6. S(B, 28)=(1,2,3,4,5,6,7,8,9,10,11,19,20,23,24,25,26,27,28) 7. S(C, 10)=(1,2,3,4,9,10,28) 8. S(C, 16)=(1,2,3,4,5,6,7,8,9,10,11,12,15,16,17,18,27,28) 9. S(C, 21)=(1,2,3,4,5,6,7,8,9,10,11,19,20,21,22,26,27,28) 10. S(C, 28)=(1,2,3,4,5,6,7,8,9,10,11,19,20,21,22,26,27,28) Slices for the given program
#include<stdio.h> #include<conio.h> S. No Slice Paths A B C Expected 1 void�main() 2 { output 3 float�A,B,C; S(B, 28) 6 1,2,3,4,5,6,7,8,9,10,11,19, 4 clrscr(); 20,23,24,25,26,27,28 7 9 8 9 5 printf("Enter�number��1:\n"); 6 scanf("%f",�&A); 7 printf("Enter�number��2:\n"); S(C, 10) 1,2,3,4,9,10,28 8 7 8 scanf("%f",�&B); 9 printf("Enter�number��3:\n"); S(C, 28)=(1,2,3,4,5,6,7,8,9,10,11,19,20,21,22,26,27,28) 10 scanf("%f",�&C); 1,2,3,4,5,6,7,8,9,10,11,12, 8 7 9 9 11 if(A>B)�{��/*do�nothing*/ 8 S(C, 16) 15,16,17,18,27,28 18 } 19 else���{ 1,2,3,4,5,6,7,8,9,10,11,19, 20 if(C>B)�{ 7 8 9 9 9 S(C, 21) 20,21,22,26,27,28 21 printf("The�largest�number�is:�%f\n",C); 22 } 1,2,3,4,5,6,7,8,9,10,11,19, 7 8 9 9 26 } 10 S(C, 28) 20,21,22,26,27,28 27 getch(); 28 } Slice Based Testing � It focuses on a portion of a program with respect to a variable location in any statement of the program. � Slicing cannot test a behaviour which is not represented by a set of variables or a variable of the program.