160 likes | 318 Views
Software Testing. Boundaries and C0,C1 Pressman pp437-476. Instrument Your Code. To achieve C0 or C1 coverage, generate good test cases until coverage has been reached. By hand, insert print statements with “a”, “b”, etc and sort output
E N D
Software Testing Boundaries and C0,C1 Pressman pp437-476
Instrument Your Code • To achieve C0 or C1 coverage, generate good test cases until coverage has been reached. • By hand, insert print statements with “a”, “b”, etc and sort output • In Dec, I will expect teams to demonstrate that they have achieved C0 coverage of their code.
Subdomain (not in Pressman) • A subdomain is a set of input points (data points, tests, etc) that are treated identically by the program. That is, they take the same path through the program and the same operations are applied to the values. • Or a set of such subdomains
Boundary Testing • A boundary test tries to establish that the boundary is in the correct spot. • Thus, test cases are chosen on the boundary and as close as possible on the open side. • “2-on, 1-off” means two on the boundary spread far apart and one just off the boundary in between the other two
Payroll Problem • Wages must be greater than zero and less than 100 • Hours must be greater than zero and less than 80 • Time and a half is paid on hours over 40
Boundary Example - 2on/1off I-V : (0,100),(40,100),(20,99) V II-V : (41,100),(79,100),(60,99) I II I-II : (40,1),(40,99),(41,50)
TTYP1 - boundary tests • Determine boundary tests for the boundary between “a” and “d” cin>>x>>y; output= “d”; if(y>x) output = “a”; if(x>5) output = “b”; if (y < 0) output = “c”; cout << output;
TTYP2 - the triangle program • Assume max length is 10 • In the a=b plane, what would be 2-on, 1-off tests for the boundary between isosceles and not-a-triangle?
Independent Paths • The independent paths are? • A - {aceg, abcdefg} • B - {abc,cde,efg} • C - {aceg,abc,cde,efg}
Basis Paths for testing • McCabe’s basis testing does not have a theoretical foundation • Pressman does not give a precise enough definition of basis set or independent path to be useful • Advice - use other criteria
For Tuesday, Oct 15th • Read chapter 18 • pp 477-505
Triangle Example cin >> a >> b >> c ; type = “scalene”; if (a == b || a == c || b == c) type= “isoscoles”; if (a == b && a == c) type = “equilateral”; if (a >= b+c || b >= a+c || c >= a+b) type=“not a triangle”; if (a <= 0 || b <= 0 || c <= 0) type=“bad input”; cout<< type;
Control Flow Graph TTYP1 – what are the paths through this code?