Download presentation
Presentation is loading. Please wait.
Published byOwen Charles Modified over 9 years ago
2
Black box testing Black box tests focus on the input/output behavior of the component Black-box tests do not deal with the internal aspects of the component nor with the behavior or the structure of the components
3
Equivalence testing Equivalence testing is a black box testing technique that minimizes the number of test cases
4
Equivalence testing The possible inputs are partitioned into equivalence classes, a test case is selected for each class The assumption of equivalence testing is that systems usually behave in similar ways for all members of a class
5
Equivalence testing Equivalence testing consists of two steps: identification of the equivalence classes selection of the test inputs
6
Equivalence classes Coverage: every possible input belongs to one of the equivalence classes Disjointedness: no input belongs to more than one equivalence class I.e., partition
7
Equivalence classes Representation: if the execution demonstrates an error when a particular member of a equivalence class is used as input, then the same error can be detected by using any other member of the class as input.
8
Test cases For each equivalence class, at least two pieces of data are selected a typical input, which exercises the common case an invalid input, which exercises the exception handling capabilities of the component
9
Boundary testing Boundary testing is a special case of equivalence testing and focuses on the conditions at the boundary of the equivalence classes
10
Boundary testing The assumption behind boundary testing is that developers often overlook special cases at the boundary of the equivalence classes E.g., Empty strings Year 2000 (millennium bug) …
11
Int converter (again) A function converts a sequence of chars in an integer number. The sequence can start with a ‘-‘ (negative number). The integer number must be in the range minint = -32768 to maxint = 32767. The function signals an error if the sequence of chars is not allowed The sequence must be <= 6 chars
12
Int converter (again) 1.Define equivalence classes, and related boundary condition 2.For each class, define at least one test case
13
Criterion Input is a decimal number (well formed integer) Valid: may start with –, no characters that are not digits Invalid: … Boundary: Starting “+”? Blanks?
14
Criterion Length of string, number of characters Valid: <= 6 Invalid: > 6 Boundary: 6, 0
15
Criterion Range of number in output Valid: = minint Invalid: > maxint, < minint Boundary: maxint, minint
16
Calendar BB Consider a method that returns the number of days in a month, given the month and year. public class MyGregorianCalendar { public static int getNumDaysInMonth(int x, int y){... } The month and the year are specified as integers. By convention, 1 represents the month of January, 2 the month of February, and so on. The range of valid inputs for the year is 0 to maxInt. 1.define equivalence classes, and related boundary condition 2.for each class, define at least one test case
17
Classes for month parameter Three equivalence classes: months with 31 days (i.e., 1, 3, 5, 7, 8, 10, 12) months with 30 days (i.e., 4, 6, 9, 11) February, which can have 28 or 29 days Nonpositive integers and integers larger than 12 are invalid values
18
Classes for year parameter Two equivalence classes: leap years non–leap years Negative integers are invalid values
19
Selected valid inputs
20
Additional boundary cases
21
Equivalence classes definition An interval condition will have classes for Valid input within the interval Invalid input less than the minimum Invalid input greater than the maximum Valid input close the boundaries A single value condition will have classes for: The valid value Invalid values less than the value Invalid values greater than the value
22
Equivalence classes definition A discrete set condition will have classes for: Each value in the set A value not belonging to the set A boolean value condition will have classes for: TRUE value FALSE value
23
Parallelogram The function parallelogram(int x1, int x2, int x3, int x4, int y1, int y2, int y3, int y4) calculate the area of a parallelogram.
24
Parallelogram Requirements area is always strictly > 0 The parallelogram should stay in the first quadrant of the Cartesian plan Define equivalence classes and tests
25
Criteria Pair sides parallelism Pair same sides length Position (1 st quadrant) Area > 0
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.