Unit 3 Domain Testing
Unit 3 Domain Testing
• Domain Testing
• Domains
• Model, as a set, paths
• Predicates
• closure, dimensionality, assumptions
• Nice & ugly domains
• specified & implemented domains
• Nice domains – properties, testing implications
• Ugly domains, simplification by programmers & testers
• Domain testing
• Bugs & testing for those bugs
• Testing procedure
• Variations, tools, effectiveness
• Domains & Interface Testing
• Range, closure, span
• Interface range, domain compatibility
• Finding the values
• Domains & Testability
• Linearizing, coordinate transformations. Canonical program form
D1
D2
INPUT CLASSIFY DO CASE 1 OUTPUT
D3
(x,y,z,…) Dn { Outcome }
DO CASE 2
(1, 2, 3, 4, 5,…)
DO CASE 3
DO CASE n
Domain Testing
Two Views
• Based on Specs
• Functional Testing
• Structural Technique
• Variables
• Simple combinations of two variables
• Numbers from - to +
• Loop-free Programs
Domain (simplified)
• Specified by predicates
Predicates
• Interpretation
Paths
Summary:
• Domain for a loop-free program corresponds to a set of
numbers defined over the input vector
MIN MAX
D1 D2 D3
Closed
X >= MIN
D2 X < MAX
D1 D3
MIN MAX
D1 D2 D3
Open
X > MIN X < MAX
• Slicing Boundary
• Double-zero representation
• Positive and negative zero, errors for –ve zero
• Contradictory domains
• means that at least two supposedly distinct domains overlap
• Ambiguous domains
• union of the specified domains is incomplete
• either missing domains or holes in the specified domains
defined
• what happens to points on the domain boundary
undefined
17 ref boris beizer
Domain Testing - Domains & Paths – Bug Assumptions.. U3
• Boundary errors
Boundary closure
Shifted
18 ref boris beizer
Domain Testing - Domains & Paths - Bug Assumptions U3
• Boundary errors….
Tilted
Missing
Extra boundary
X >= 3
• Closure Reversal
• Incorrect implementation of logic
• Faulty Logic
Simplification of compound
predicates
In General…
1. Coincidental Correctness
• DT cannot detect where outcome is correct for the wrong reasons
Example –
• if the domain is a disconnected mess of small subdomains, each of which has a binary
outcome or if outcomes are restricted to a few discrete values
F1(x) : +1
• Representative outcome D1
D2
Input Equivalence
F2(x) : -1
Function f1
D1
INPUT CLASSIFY DO CASE 1 OUTPUT
(x, y, z, …) D2 { Outcome }
DO CASE 2
(1, 2, 3, 4, 5,…) f2
D3
DO CASE 3
f3
Dn
f4
DO CASE n
D1
X X >=0 .AND. X <= 16
0 16
D1
Y Y = 1 .AND. X >=0 .AND. X <= 16
0 16
X
Compound predicates….
• Impact of .OR.
• Concave, Disconnected
• Example
ABC + DEF
a x + b y >= c
• Polynomials
6. Loop-free Software
Definite loop
Nice Domains
Requirements
Before DT
• Analyze specs
Implemented Domains
Specified Domains
• Incomplete, Inconsistent
Nice Domains
U1 U2
V1 D11 D12
V2 D21 D22
Nice Domains
Advantages
• Ease of DT
Nice Domains
Boundaries are
1. Linear
2. Complete
3. Systematic
4. Orthogonal
5. Closure Consistency
6. Convex
7. Simply Connected
1. Linear Boundaries
Interpreted linear inequalities
only two (test) points to determine a straight line
three points to determine a plane, and
n + 1 points to determine an n-dimensional hyperplane
n-dim Hyperplane:
n+1 Points
Non-Linear
more than 99.99% of all boundary predicates are either
directly linear or can be linearized by simple variable transformations
• Transform
2. Complete Boundaries
Incomplete…
• Reasons
• Unachievable paths
• compound predicates that define a single boundary
• redundant predicates convert suchboundary values into a null set
• Tests
• Few number of tests for complete boundaries
3. Systematic Boundaries
• Linear Inequalities differing by a constant
• Parallel lines
• Identical Sectors in a Circle
4. Orthogonal Boundaries
• Parallel to axes
every inequality in V is perpendicular to every inequality in U
If two boundary sets are orthogonal, then they can be tested independently
• DT
• # Tests O (n)
The notation O(n) means of the order of. For example, O(n) is a linear growth,
O(n2) is a quadratic growth, and
O(2n) is an exponential growth Vj
Orthogonal Boundaries
• Tilted sets
• transformation
• Test cases: O(n)
Orthogonality can depend on the coordinate system chosen
• Concentric circles with radial lines
Non-Orthogonal Boundaries
5. Closure Consistency
• Example
D3 D1 D2 D4
6. Convex Domain
• Line joining any two points lies with in the domain
• DT
• n on-points & 1 off-pt
Concave
D2
D1
• 2 complementary domains
• Programmer / Designer
• Convex part First
42 ref boris beizer
Domain Testing - Domains & Paths – Ugly Domains U3
Generally,
Causes
1. Non-linear Boundaries
2. Ambiguities & Contradictions
3. Simplifying the topology
4. Rectifying boundary closures
1. Non-linear Boundaries
• Transform
2. Ambiguities
• Missing boundary
2. Contradictions..
• Overlapping of
• Domain Specs
• Closure Specs
D3
D1 D2
• Complexity !
• Generic cases
• Concavity, Holes, Disconnectedness
Programmers introduce bugs and testers mis-design test cases by
3. smoothing out concavities
4. filling in holes
5. joining disconnected pieces
• Filling in Holes
Correct:
General DT Strategy
Generally,
• Interior point - point in the domain such that all points within an arbitrarily small distance (called
an
epsilon neighborhood) are also in the domain.
• Boundary point - within an epsilon neighborhood there are points both in the domain and not in
the domain.
• Extreme point - that does not lie between any two other arbitrary but distinct points of a (convex)
domain
• On point - is a point on the boundary
• Off Point - a point near the boundary but in the adjacent domain if the domain is closed
- a point near the boundary but in the domain being tested if the domain is open
You can remember this by the acronym COOOOI: Closed Off Outside, Open Off Inside
Extreme
point
Boundary point
Epsilon neighborhood
On Points
Domain D1
54 ref boris beizer
Domain Testing - Domains & Paths – Domain Testing U3
1. 1-d Domains
2. 2-d Domains
4. Random Testing
B A B A
Closure Bug
x x
B A
Shift left Bug
x1 x
B A
Shift Right Bug
x x1
B A B A
Missing Boundary x
x x
Extra Boundary B A C
x x
x x1
• Closure bug
• Tilted Boundary
• Extra Boundary
• Missing Boundary
a
A
c c’
c
d
B
To avoid bugs
4. Random Testing
• Independent testing
62 ref boris beizer
Domain Testing - Domains & Paths – Domain Testing U3
Procedure
Effectiveness
• Cost effective
• Domain
• Range
Variable
Range for Domain for Range for
Routine 1 Routine 2
Domain Routine1 Routine2 Routine2
• Span compatibility
• Closure compatibility
• Linearizing transformations
• Polynomial
• Rectangular to polar
• Generic & rational => Taylor series
• Co-ordinate transformations