Black box testing is also known as functional testing or data-driven testing
Black-box testing methods: equivalence class division, boundary value analysis, error guessing, cause-and-effect diagram and decision table (decision tree-flow chart), orthogonal experiment method, scenario method, exploratory testing
equivalence class division
According to the requirements, divide all possible user input into several subsets, and then select a small amount of representative data from each subset as test cases
Equivalence Class Partition Design Steps
1. First divide the equivalence class: find out all possible classifications
2. Confirm valid equivalence classes: conditions in requirements
3. Confirm the invalid equivalence class: the situation opposite to the condition, and then find a special situation (considering various possible situations)
4. Select specific test case data from each category
the case
There is a program for calculating the addition of two numbers, which can only calculate positive integers up to 100.
Requirements analysis
1. 1-100 integer addition, 2. There are two input boxes.
1. Identify possible input data
Integer, decimal, letter, Chinese character, symbol, space, carriage return, no input
2. Confirm the range of equivalence classes
input conditions |
effective equivalence class |
invalid equivalence class |
1-100 integer, value range [1, 100] |
[1, 100] integer |
<1 integer |
>100 integers |
||
decimal |
||
letter |
||
Chinese character |
||
special symbols |
||
null |
3. Select specific test case data
Note: When testing an invalid equivalence class, another variable should be a valid equivalence class to ensure that the variable is unique.
serial number |
belongs to equivalence class |
input box 1 |
input box 2 |
expected outcome |
1 |
efficient |
45 |
23 |
68 |
2 |
invalid |
-15 |
58 |
give error message |
3 |
invalid |
58 |
-15 | give error message |
4 |
invalid |
105 |
50 |
give error message |
5 |
invalid |
50 |
105 |
give error message |
6 |
invalid |
3.23 |
45 |
give error message |
7 |
invalid |
45 |
3.23 |
give error message |
8 |
invalid |
ab |
11 |
give error message |
9 |
invalid |
11 |
ab |
give error message |
10 |
invalid |
I |
34 |
give error message |
11 |
invalid |
34 |
I |
give error message |
12 |
invalid |
% |
56 |
give error message |
13 |
invalid |
56 |
% |
give error message |
14 |
invalid |
78 |
give error message |
|
15 |
invalid |
78 |
give error message |
boundary value analysis
Errors usually occur in the boundary range of input and output. Designing test cases for edge cases can find more errors.
Boundary value selection principle
The boundary value method is usually used as a supplementary method of equivalence class division, and the test cases come from the boundary of the equivalence class.
Pick values that are exactly equal to, just greater than, or just less than the bounds as test data.
The concept of upper point, departure point and inner point
Upper point: The point on the boundary, regardless of whether the domain is an open interval or a closed interval, the upper point of the open interval is outside the domain, and the upper point of the closed interval is inside the domain.
Departure point: The point closest to the upper point, which is related to whether the domain is an open interval or a closed interval. The detachment point of the open interval is within the domain, and the detachment point of the closed interval is outside the domain.
Inlier: Any point in the domain is an inlier
For example: [1,100], (1,100), the upper points are both 1 and 100, the difference is that the former 1 and 100 are within the domain, and the latter 1 and 100 are outside the domain. The departure point of the former is 0, 101, and the departure point of the latter is 2, 99; the departure point is related to the precision of the value, for example, the case of taking an integer.
Completing the above example of the addition program
According to the boundary value method, confirm the boundary values: 0, 1, 2, 99, 100, 101.
4. Improve supplementary test data
serial number |
belongs to equivalence class |
input box 1 |
input box 2 |
expected outcome |
1 |
efficient |
1 |
100 |
101 |
2 |
efficient |
2 |
99 |
101 |
3 |
efficient |
99 |
2 |
101 |
4 |
efficient |
100 |
1 |
101 |
5 |
invalid |
0 |
40 |
give error message |
6 |
invalid |
40 |
0 |
give error message |
7 |
invalid |
101 |
50 |
give error message |
8 |
invalid |
50 |
101 |
give error message |
9 |
invalid |
3.23 |
45 |
give error message |
10 |
invalid |
45 |
3.23 |
give error message |
11 |
invalid |
ab |
11 |
give error message |
12 |
invalid |
11 |
ab |
give error message |
13 |
invalid |
I |
34 |
give error message |
14 |
invalid |
34 |
I |
give error message |
15 |
invalid |
% |
56 |
give error message |
16 |
invalid |
56 |
% |
give error message |
17 |
invalid |
78 |
give error message |
|
18 |
invalid |
78 |
give error message |