Download presentation
Presentation is loading. Please wait.
1
1 Software Testing and Quality Assurance Lecture 6 - Software Testing Techniques
2
2 Lecture Outline Introduction to domain testing. How to select test cases based on domain boundaries.
3
3 Domain Testing Partition input of a program using the program structure itself. Input space is first partitioned into a set of mutually exclusive classes. Each corresponds to a program path. Test cases are selected from The domain boundaries Points close to the domain boundaries.
4
4 Example int f (float x, y) { float w, z; w = x + y; if (x + y ≥ 2){ z = x - 3y; } else { z = 2x - 5y; } if (z + w > 3) z = f(x,y,z); else z = g(x,y,z); } Return z; } Two If/then/else statements
5
5 Example int f (float x, y) { float w, z; w = x + y; if (x + y ≥ 2){ z = x - 3y; } else { z = 2x - 5y; } if (z + w > 3) z = f(x,y,z); else z = g(x,y,z); } Return z; } C1ax+y≥2 C1bx+y<2 C2a(C1 T)2x-2y>3 C2b(C1 F)3x-4y>3
6
6 Domains for the program (2,0) TT FT (3/22,0) (1,0) TF FF (0,2) (0,3/22) (0,4/3)
7
7 Simple & Compound Predicates Simple predicates contain a set of variables such as, = etc. Create simple boundaries. Compound predicate are AND operators OR operators Combination of both
8
8 Compound Predicate - Example X ≤ 0X ≥ 2 Sun-domain This region is not part of the sub-domain being tested. X ≤ 0 V X ≥ 2 Function 1 Function 2
9
9 Loops in programs If each program path corresponds to a function; then for loops We may have an infinite number of paths. An infinite number of equivalence classes. Apply zero- to-many rule. Minimum number of times a loop can execute is zero. Some loops have upper bound, so treat that as a path.
10
10 Loops in programs Zero times - we can test paths that do no execute the loop. Once - test that the loop can be entered and result of single iteration are correct. Twice - to test that the results remain correct between different iterations of loop. N times (more than 2) - to test that an arbitrary number of iterations returns the correct results; and N + 1 times - test that after an arbitrary number of iterations the result remain correct.
11
11 Key points To select test cases, input space is first partitioned into a set of equivalence classes. Simple predicates. Compound predicates. Loops
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.