450 likes | 460 Views
Learn about equivalence partitioning and boundary value analysis and how they help improve testing effectiveness and efficiency. Explore examples and heuristics for test case selection.
E N D
WARNING 20 min • These slides are not optimized for printing or exam preparation. These are for lecture delivery only. • These slides are made for PowerPoint 2010. They may not show up well on other PowerPoint versions. You can download PowerPoint 2010 viewer from here. • These slides contain a lot of animations. For optimal results, watch in slideshow mode.
What is an Equivalence Partition? How does it help to improve E&E of testing? What are the EPs for name in the method below? /** * Adds the name to the course list. * @param name must be between 5 to 50 chars (both inclusive) * and not already in the course list */ void addName(String name) { … } 5..50 Case sensitivity? Leading/trailing spaces? > 50 in the list < 5 not in the list null Empty string
How to choose? E&E of testing Some heuristics Test case Test case Test case Test case Test case Test case Test case Test case Equivalence partitioning
How to choose? E&E of testing Some heuristics Test case Test case Test case Test case Test case Test case Test case Test case Equivalence partitioning Boundary value analysis
How to choose? E&E of testing Some heuristics Test case Test case Test case Test case Test case Test case Test case Test case Equivalence partitioning Boundary value analysis
Boundary value analysis isValidMonth(int m): boolean 0 1 12 13 MAX_INT MIN_INT
Boundary value analysis isValidMonth(int m): boolean 0 1 12 13 MAX_INT MIN_INT
Boundary value analysis isValidMonth(int m): boolean 0 1 12 13 MAX_INT MIN_INT if(m>=1)||(m<12) … if(m>=1)||(m<=12) …
Boundary value analysis isValidMonth(int m): boolean 0 1 12 13 MAX_INT MIN_INT
Boundary value analysis isValidMonth(int m): boolean 0 1 12 13 MAX_INT MIN_INT
Boundary value analysis What are the boundary values for i? isPrimeNumber(inti):boolean Description: Checks if i is a prime number. Returns true if iis a prime number, false otherwise. Prime numbers Not prime numbers
Boundary value analysis What are the boundary values for i? isPrimeNumber(inti):boolean Description: Checks if i is a prime number. Returns true if iis a prime number, false otherwise.
How to choose? E&E of testing Some heuristics Test case Test case Test case Test case Test case Test case Test case Test case Equivalence partitioning Boundary value analysis BVA helps to improve E&E by …
How to choose? E&E of testing Some heuristics Test case Test case Test case Test case Test case Test case Test case Test case Equivalence partitioning Boundary value analysis Combining multiple inputs
How to choose? E&E of testing Some heuristics Test case Test case Test case Test case Test case Test case Test case Test case Equivalence partitioning Boundary value analysis Combining multiple inputs
Combining multiple inputs :MSLogic markCellAt(x,y)
Combining multiple inputs markCellAt(x,y) markCellAt(x,y)
Combining multiple inputs markCellAt(x,y) MSLogic x y Cell GAME_STATE
Combining multiple inputs markCellAt(x,y) x y Cell GAME_STATE HIDDEN MARKED CLEARED INC_MARKED INC_CLEARED PRE_GAME READY IN_PLAY WON LOST [MIN_INT..-1][0..(W-1)][W..MAX_INT] [MIN_INT..-1] [0..(H-1)] [H..MAX_INT] W -> Width H -> Height
Combining multiple inputs markCellAt(x,y) x y Cell GAME_STATE HIDDEN MARKED CLEARED INC_MARKED INC_CLEARED PRE_GAME READY IN_PLAY WON LOST [MIN_INT..-1][0..(W-1)][W..MAX_INT] [MIN_INT..-1] [0..(H-1)] [H..MAX_INT] MIN_INT, -2, -1,0, 2, (W-1), W, W+1, MAX_INT
Combining multiple inputs markCellAt(x,y) x y Cell GAME_STATE HIDDEN MARKED CLEARED INC_MARKED INC_CLEARED PRE_GAME READY IN_PLAY WON LOST [MIN_INT..-1][0..(W-1)][W..MAX_INT] [MIN_INT..-1] [0..(H-1)] [H..MAX_INT] MIN_INT, -2, -1,0, 2, (W-1), W, W+1, MAX_INT MIN_INT, -2, -1,0, 2, (H-1), H, H+1, MAX_INT
Combining multiple inputs markCellAt(x,y) x y Cell GAME_STATE HIDDEN MARKED CLEARED INC_MARKED INC_CLEARED PRE_GAME READY IN_PLAY WON LOST MIN_INT, -2, -1,0, 2, (W-1), W, W+1, MAX_INT MIN_INT, -2, -1,0, 2, (H-1), H, H+1, MAX_INT
Combining multiple inputs markCellAt(x,y) Cell GAME_STATE HIDDEN MARKED CLEARED INC_MARKED INC_CLEARED PRE_GAME READY IN_PLAY WON LOST y MIN_INT, -2, -1,0, 2, (H-1), H, H+1, MAX_INT x MIN_INT, -2, -1,0, 2, (W-1), W, W+1, MAX_INT
Combining multiple inputs markCellAt(x,y) Cell GAME_STATE HIDDEN MARKED CLEARED INC_MARKED INC_CLEARED PRE_GAME READY IN_PLAY WON LOST y MIN_INT, -2, -1,0, 2, (H-1), H, H+1, MAX_INT x MIN_INT, -2, -1,0, 2, (W-1), W, W+1, MAX_INT
Combining multiple inputs markCellAt(x,y) Cell GAME_STATE HIDDEN MARKED CLEARED INC_MARKED INC_CLEARED PRE_GAME READY IN_PLAY WON LOST y MIN_INT, -2, -1,0, 2, (H-1), H, H+1, MAX_INT x MIN_INT, -2, -1,0, 2, (W-1), W, W+1, MAX_INT 9x9x5x5= 2025
Combining multiple inputs 3x3x2= 18 Payment for testing: $100 Cost per test case: $10 Penalty for uncaught bug: $200 Work out a set of test cases that is both E&E. How many do you have? count {answer} e.g. count 9 77577OR tinyurl.com/answerpost
Combining multiple inputs 3x3x2= 18
Combining multiple inputs 3x3x2= 18
Combining multiple inputs 3x3x2= 18
Heuristic : Each valid input should appear at least once without invalid inputs
Heuristic : Each valid input should appear at least once without invalid inputs
Heuristic : Each valid input should appear at least once without invalid inputs
Heuristic : Each valid input should appear at least once without invalid inputs
5 3x3x2= 18 Heuristic: Only one invalid input per test case
How to choose? E&E of testing Some heuristics Test case Test case Test case Test case Test case Test case Test case Test case Equivalence partitioning Boundary value analysis Combining multiple inputs
Apply in *some* places. e.g. • //5 is a boundary value for size • assertEquals(5, getSize());
Other QA techniques Test case design heuristics