1841f07subdomains2aug23 question u what is the main purpose of software testing?
TRANSCRIPT
1841f07subdomains2Aug23
Question
What is the main purpose of software testing?
2841f07subdomains2Aug23
Testing Basics
Subdomains
4841f07subdomains2Aug23
Failure Set
The failure set for a fault is the set of points in the program domain that display the fault, that is, cause the output to be different from specified.
5841f07subdomains2Aug23
Programming task
Who had the smallest failure set?
Who had the largest failure set?
Who had a strange failure set?
6841f07subdomains2Aug23
Failure Set
-15
-10
-5
0
5
10
15
-15 -10 -5 0 5 10 15
Series1
8841f07subdomains2Aug23
Subdomain
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 Sometimes called a partition
9841f07subdomains2Aug23
Different uses in the literature
Much like mine – with mutual exclusion Arbitrary division of the input domain Any definable subset of the input domain
Other?
10841f07subdomains2Aug23
Example - 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
11841f07subdomains2Aug23
Subdomains of Example
I II
0,0
0,100
40,0 80,0
12841f07subdomains2Aug23
TTYP – how do faults affect the subdomains?
Pay = hours * wage
If hours > 40 then pay = pay + .5*(hours-40)*wage Consider some possible faults in the payroll
program– Can you find faults that affect a whole subdomain?
– Can you find faults that move the boundaries?
– Can you find faults that make bigger changes?
13841f07subdomains2Aug23
Boundary Testing Example - 2on/1off
V
I II
I-V : (0,100),(40,100),(20,99)
II-V : (41,100),(79,100),(60,99)
I-II : (40,1),(40,99),(41,50)
14841f07subdomains2Aug23
Triangle Example
cin >> a >> b >> c ;type = “scalene”;if (a == b || a == c || b == c) type= “isosceles”;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;
15841f07subdomains2Aug23
Triangle Domain : a = b plane
a=b
c
a=b=c
a=b=.5c
not a triangle
isosceles
bad inputs
isosceles
bad inputs
16841f07subdomains2Aug23
Triangle Domain : a = .5b plane
a=.5b
c
a=.5b=.5c
not a triangle
scalene
bad inputs
isosceles
bad inputs
a+b=c
a=b+c
scalene
not a triangle
17841f07subdomains2Aug23
Control Flow Graph
I: cout
B: type = isoscles
D: type = equilateral
F: type = not a triangle
H: type = bad input
A: type = scalene
C: if
E: if
G: if
18841f07subdomains2Aug23
TTYP - subdomains
Are paths the best subdomains? Would a functional decomposition be
better? Should we re-define the term subdomain?
19841f07subdomains2Aug23
For Tuesday, Aug 28
Read ch28 – Shrostrup’s chapter on testing