Boundary Testing
EPC: Extreme-point Combination
Test point: \(4^n+1\)
1D
input: when consists of a single variable, can directly use the four values: "under", "min", "max", "over".
An input sub-domain, \(0 \leq x <21\), the test points: \(-1, 0, 10, 21, 22\)
EPC can consistently detect closure and missing boundary problems for the single input situations. but cannot consistently detect boundary shift or extra boundary problems.
2D / nD
- Define domain, suppose \(x_0 = 0, y_0 = 0, r = 1, ie. x^2 +y^2 \leq r^2\)
input: under [min, max, interior] over
- max: \((1,0), (0,1)\)
min: \((-1, 0), (0, -1)\)
inter: \((0,0)\)
over: \((1.25, 0.25), (1.5, 0), (1.25, -0.25); (0,1.5), (-0.25, 1.25), (0.25, 1.25)\)
under: \((-1.5, 0), (-1.25, -0.25), (-1.25, 0.25); (-0.25, -1.25), (0, -1.5), (0.25, -1.25)\)
There are 16 + 1 EPC points, max + min + over + under + inter= $ (4^n + 1)$ = \(4^2 + 1\) = 17
Cost: EPC can be costly, since it would involve setting up test cases for each extrem point. The circle could mean a considerable number of test points.
Weak N x 1 Strategy
It uses (\(n\) ON points (linearly independent) and \(1\) OFF points) to be defined below for each boundary.
test points: \((n + 1) \times b + 1\)
1D
-
define domain input: [0, 21), boundaries define: 2 boundaries => b = 2
-
\(n\) ON points => (1 ON point, 1 OFF point) as pair;
ON point \(z = 0\), OFF point \(z = -1\);
ON point \(z = 21\), OFF point \(z = 20\);
interior \(z = 10\);
Test points = \(2 \times b +1 = 2 \times 2 +1 = 5\)
2D
- define domain input:
- \(n\) ON points => (2 ON points, 1 OFF points) as pair
优点: 能够更全面地探测边界附近的错误, 因为它在每个边界上测试了多个点
缺点: 需要的测试点数量多, 特别是在输入变量数量较多的情况下, 会导致测试成本高
Weak: set of tests per boundary instead of per boundary segment.
Typical erros detected:
-
Closure bug
-
Boundary shift
- Boundary tilt (later)
- Extra boundary (sometimes)
- Missing boundary
Weak 1 x 1 Strategy
1D Same as Nx1
2D
- define input, define boundary
1 boundary 1 ON point, 1 OFF point (每个边界选取一个测试点).
Test points: \(2 b + 1\)
- 优点:显著减少了需要的测试点数量,从而降低了测试成本。
- 缺点:可能无法检测到所有的边界相关错误,尤其是那些需要在边界附近多个点检测的问题。
EPC | Weak Nx1 | Weak 1x1 | |
---|---|---|---|
Test points | \(4^n + 1\) | \((n+1)\times b + 1\) | \(2b+1\) (b boundaries) |
BT Limitations
- Simple processing/defect models:
- Processing: case-like, general enough?
- Specification: ambiguous/contradictory.
- Boundary: likely defect.
-
Vertex: ad hoc logic.
-
Limitations
- Processing model: no loops.
- Coincidental correctness: common.
- ε-limits, particularly problematic for multi-platform products.
- OFF point selection for closed domain
- possible undefined territory,
- may cause crash or similar problems.
- Detailed analysis required.
Draw a 2d region (and its boundaries) of your choice, and compare the effectiveness and cost of EPC, Weak Nx1
Weak 1x1 BT strategies.
EPC:
Input domain: x[2, 6], y[2,4] ; Four EP: A(2,4), B(6,4), C(2,2), D(6,2)
Max:(6,2), (6,4) ; Min: (2,2), (2,4)
Now can have four EPCs: A(2,4), a1(2,5), a2(1,5), a3(1,4) ;B(6,4), b1(6,5), b2(7,5), b3(7,4)
C(2,2), c1(2,1), c2(1,1), c3(1,2) ; D(6,2), d1(6,1), d2(7,1), d3(7,2)
Inter: (3,3)
Test point: \(4^n +1 = 4^2 + 1 = 17\)
Weak Nx1:
We have 4 boundaries: b1: ON1(2,3) ON2(2,4) OFF1(1,3); b2: ON4(6,3) ON5(6,2) OFF2(4,5)
b3: ON2(2,4) ON3(4,4) OFF3(4,5); b4: ON5(6,2) ON6(4,2) OFF4(4,1)
inter: (3,3) ; Test points: \((n+1)\times b +1 = 3 \times 4 + 1 = 13\)
Weak 1x1:
We have 4 boudaries: For b1: ON1(2,3), OFF1(1,3); b2: ON2(6,3), OFF2(7,3)
b3: ON(4,4), OFF(4,5); b4: ON(4,2). OFF(4,1) ;Inter: (3,3)
Test points: $2b+1 = 2 \times 4 + 1 =9 $