Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS451 – Software Testing Technologies Blackbox Testing Equivalence Partitioning.

Similar presentations


Presentation on theme: "CS451 – Software Testing Technologies Blackbox Testing Equivalence Partitioning."— Presentation transcript:

1 CS451 – Software Testing Technologies Blackbox Testing Equivalence Partitioning

2 Input domain Too many test inputs. Four test inputs, one selected from each sub-domain. 1 2 3 4 Input domain partitioned into four sub-domains.

3 How to partition? Inputs to a program provide clues to partitioning. Example 1: –Suppose that program P takes an integer X as input X. –For X =0 task T2. –P to behave the same way for all X<0. –P to perform the same way for all values of X>=0. We therefore partition the input domain of P into two sub- domains.

4 Two sub-domains One test case: X=-3 Another test case: X=15 All test inputs in the X<0 sub-domain are considered equivalent. The assumption is that if one test input in this sub-domain reveals an error in the program, so will the others. This is true of the test inputs in the X>=0 sub-domain also. X<0X>=0 Equivalence class

5 Non-overlapping Partitions The equivalence classes are non-overlapping. In other words the two sub-domains are disjoint. When the sub-domains are disjoint, it is sufficient to pick one test input from each equivalence class to test the program. An equivalence class is considered covered when at least one test has been selected from it. In partition testing our goal is to cover all equivalence classes.

6 Overlapping Partitions Example 2: Suppose that program P takes three integers X, Y and Z. It is known that: X Y X<Y X>=Y Z>Y Z<=Y X Y X=3, Y=4, Z=7 X<Y, Z<=Y X=2, Y=3, Z=1 X>=Y, Z>Y X=15, Y=4, Z=7 X>=Y, Z<=Y X=15, Y=4, Z=1

7 Overlapping Partition-Test Selection In this example, we could select 4 test cases as: –X=4, Y=7, Z=1satisfies X<Y –X=4, Y=2, Z=1satisfies X>=Y –X=1, Y=7, Z=9satisfies Z>Y –X=1, Y=7, Z=2satisfies Z<=Y Thus, we have one test case from each equivalence class.

8 Overlapping Partitions-Test Selection However, we may also select only 2 test inputs and satisfy all four equivalence classes: –X=4, Y=7, Z=1satisfies X<Y and Z<=Y –X=4, Y=2, Z=3satisfies X>=Y and Z>Y Thus, we have reduced the number of test cases from 4 to 2 while covering each equivalence class.

9 Partitioning using non-numeric data In the previous two examples the inputs were integers. One can derive equivalence classes for other types of data also. Example 3: –Suppose that program P takes one character X and one string Y as inputs. P performs task T1 for all lower case characters and T2 for upper case characters. Also, it performs task T3 for the null string and T4 for all other strings.

10 Partitioning using non-numeric data X: lc X:UC Y: null Y: not null X: lc, Y: null X: lc, Y: not null X: UC, Y: null X: UC, Y: not null lc: Lower case character UC: Upper case character null: null string.

11 Non-numeric Data Once again we have overlapping partitions. We can select only 2 test inputs to cover all four equivalence classes. These are: –X: lower case, Y: null string –X: upper case, Y: not a null string

12 Guidelines for equivalence partitioning Input condition specifies a range: create one for the valid case and two for the invalid cases. –e.g. for a<=X<=b the classes are a<=X<=b (valid case) X b (the invalid cases)


Download ppt "CS451 – Software Testing Technologies Blackbox Testing Equivalence Partitioning."

Similar presentations


Ads by Google