Download presentation
Presentation is loading. Please wait.
Published byLetitia Morris Modified over 6 years ago
1
Software Testing Structural testing 540f07testing17oct25 1
2
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;
3
Control Flow Graph TTYP1 – what are the paths through this code?
4
Typical Structural Coverage
C0 – every statement C1 – every branch
5
Triangle Example Instrumented
cin >> a >> b >> c ; type = “scalene”; cout << “\na”; if (a == b || a == c || b == c) {cout<<“\nb”;type= “isoscoles”;} if (a == b && a == c) {cout<<“\nc”; type = “equilateral”;} if (a >= b+c || b >= a+c || c >= a+b) {cout<<“\nd”; type=“not a triangle”;} if (a <= 0 || b <= 0 || c <= 0) {cout<<“\ne”; type=“bad input”;} cout<< type;
6
Recommended use of C0 and C1
Select good test cases independent of coverage If Cx is not achieved, continue to select specific, but good test cases until Cx is achieved
7
TTYP What is a set of test cases for the “path” subdomains for the triangle code?
8
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 17
9
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
10
Boundary Example - 2on/1off
V I II
11
Triangle Domain
12
TTYP - Boundaries in the triangle program
Assume max length is 10 What would be 2-on, 1-off for the boundary between isosceles and not-a-triangle?
13
Next week Tues, Oct 30 Wed, Nov 7 Testing Plans
Read “Enhancing Software Testing by Judicious Use of Code Coverage Information” Directed Journal upload due 11am Tuesday, Oct 30 and bring a copy of directed journal to class on Tuesday Summarize the purpose of the research described in the article Describe completely the process described in the article What were the answers to the four research quesionts Describe the 10 lessons learned in order of their importance (in your view) Wed, Nov 7 HSPC – Union Ballroom
14
Muddiest Point What is your muddiest point in software testing?
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.