In this paper, the method of boundary value analysis in black box test case design is explained in detail in the form of case.
Countless test practices have shown that a large number of failures often occur on the boundary of the input definition field or the output range, not within it. Therefore, designing test cases for various boundary conditions usually results in a good test result.
Boundary value analysis method is a black box test method to test the boundary value of input or output, usually as a supplement to the equivalence class partitioning method, and its test cases come from the boundary of equivalence class.
Boundary value analysis uses the same partitioning as equivalence class partitioning, except that boundary value analysis assumes that errors exist more on the boundary of the division, so the test cases are designed on the boundary of the equivalence class and on both sides of the case.
If you are not aware of the equivalence class partitioning method, you can first read the black box test case design Technique-equivalence class partitioning method.
Principles for designing test cases for boundary values
(1) If the input condition specifies the range of values, then the boundary value just reaching this range and the value just above the bounds of the range should be taken as test input data.
(2) If the input conditions specify the number of values, then the maximum number, the minimum number and the maximum number of one more than the minimum number of 1 is a test data.
(3) According to the procedure specification of each output condition, the use principle (1).
(4) According to the procedure specification of each output condition, the use principle (2).
(5) If the program's specification indicates that the input field or output field is an ordered set (such as an ordered table, sequential file, and so on), then the first and last element in the collection should be selected as the test case.
(6) If an internal data structure is used in the program, the value on the boundary of the internal data structure should be selected as the test case.
(7) Analyze the procedure specification to find out other possible boundary conditions.
Example
A program has the following functions: The text box requires the input of date information, the date is limited to January 1990 ~2049 December, and the date is set by 6-digit characters, the first 4 digits of the year, the last 2 digits for the month, the program needs to verify the date validity of the input.
The method of equivalence class partitioning and boundary value analysis are used to design the test cases for the "date checking function" of the program.
Dividing equivalence classes & selecting boundary values
Step one, requires the input of 6 numeric characters Yyyynn; The reference equivalence class Division law is 5, divided into a valid equivalence class and three invalid equivalence class.
- Valid equivalence class (1): Enter 6 numeric characters
- Invalid equivalence class (2): Enter 6 characters, there is a case of non-digit
- Using the boundary value, 6 characters Embox is non-numeric: abcdef
- With the boundary value, 1 of 6 characters are non-numeric: 19930m
- Invalid equivalence class (3): Enter less than 6 numeric characters
- Using boundary values, enter 5 numeric characters
- Invalid equivalence class (4): Enter more than 6 numeric characters
- Using boundary values, enter 7 numeric characters
Step two, on the basis of the effective equivalence class (1), according to the Equivalence class Division Law 6, the equivalence class is subdivided; to examine whether 6 numbers meet the date format requirements, 1990<=yyyy<=2049,01<=nn<=12, reference rules, is divided into a valid equivalence class and four invalid equivalence classes.
- Valid equivalence Class (5): Date format meets requirements, 1990<=yyyy<=2049,01<=nn<=12
- Using the boundary value, [Yyyy,nn] takes the value: [1990,06],[1991,06],[2020,06],[2020,11],[2020,12]
- Invalid equivalence class (6): YYYY does not meet the requirements, yyyy<1990
- Using the boundary value, [Yyyy,nn] takes the value: [1989,06]
- Invalid equivalence class (7): YYYY does not meet the requirements, yyyy>2049
- Using the boundary value, [Yyyy,nn] takes the value: [2050,06]
- Invalid equivalence class (8): NN does not meet the requirements, nn<01
- Using the boundary value, [Yyyy,nn] takes the value: [2020,00]
- Invalid equivalence class (9): NN does not meet the requirements, nn>12
- Using the boundary value, [Yyyy,nn] takes the value: [2020,13]
Design Test Cases
Serial Number |
Yyyynn |
overriding equivalence classes |
Expected output Results |
– |
– |
Overriding valid equivalence classes and boundary values |
– |
1 |
199006 |
(1) (5) |
Date format is valid |
2 |
199106 |
(1) (5) |
Date format is valid |
3 |
202006 |
(1) (5) |
Date format is valid |
4 |
202011 |
(1) (5) |
Date format is valid |
5 |
202012 |
(1) (5) |
Date format is valid |
– |
– |
overriding invalid equivalence classes and boundary values |
– |
6 |
ABCdef |
(2) |
Invalid date format |
7 |
19930m |
(2) |
Invalid date format |
8 |
19935 |
(3) |
Invalid date format |
9 |
1993050 |
(4) |
Invalid date format |
10 |
198906 |
(6) |
Invalid date format |
11 |
205006 |
(7) |
Invalid date format |
12 |
202000 |
(8) |
Invalid date format |
13 |
202013 |
(9) |
Invalid date format |
Black box test Case design technology--Boundary value analysis method