Boundary Value Analysis is a common black box testing method that supplements the equivalence class division method. The so-called Boundary Value refers to the input and output equivalence classes, some specific situations that are slightly higher than the maximum value or slightly lower than the minimum value. The Boundary Value Analysis Steps include determining the boundary and selecting a test case.
I. Basic Principles:
- The error is more likely near the Extreme Value of the input variable.
- Failure is rarely caused by the occurrence of two or more defects at the same time.
- Min, min +, nom, Max-, Max.
Ii. single defect hypothesis and multi-defect hypothesis:
- Single defect hypothesis is a key assumption of Boundary Value Analysis. Single defect hypothesis refers to "Failure is rarely caused by two or more defects at the same time ". In the Boundary Value Analysis, the single defect hypothesis is that when a test case is selected, only one variable obtains the extreme value, and other variables take the normal value;
- Multi-defect hypothesis refers to "Failure is caused by two or more defects at the same time", requiring that multiple variables take the extreme values at the same time when selecting test cases.
Iii. Test Data Type of the Boundary Value: value, speed, character, address, location, size, and quantity. Iv. Classification of the Boundary Value test:
|
Single-variable hypothesis |
Multi-variable hypothesis |
Valid Value |
Basic Boundary Value Test |
Worst case Test |
Invalid value |
Robustness Test |
Robust and worst case Test |
V. Boundary Value testing technology: (1) basic boundary value testing. There are N input variables. Design a test case so that a variable can take the maximum value, slightly less than the maximum value, normal value, slightly greater than the minimum value and the minimum value in the Data effective area. As shown in, there are two variables X1 and X2. Their valid values are [c, d], [a, B]. For programs with N input variables, the number of test cases for basic boundary value analysis is 4n + 1. (2) Robustness testing. Robustness refers to the ability of the software to run normally in case of exceptions. The main aspect of robustness is the expected output, not the input. Robustness testing is a simple extension of Boundary Value Analysis. In addition to the five boundary analysis values of the variable, we also need to consider the situations where the values slightly exceed the maximum value (max) and slightly less than the minimum value (min. The biggest value of robustness testing is to observe and handle exceptions. It is an important means to detect fault tolerance of software systems. As shown in. For programs with N input variables, the number of robust test cases is 6N + 1. (3) Worst Case test. In the worst case, the test rejects the single defect hypothesis. It is concerned with the situation where multiple variables take the extreme values. In the worst case test, each input variable is first tested to contain a set of five elements, including the minimum value, slightly higher than the minimum value, normal value, slightly lower than the maximum value, and maximum value, perform Cartesian Product Calculation on these sets to generate test cases. Testing in the worst case will mean more work. As shown in. For programs with N input variables, the number of test cases in the worst case is 5 ^ n. (4) robust and worst case test. Robust and worst case scenarios assume that for each variable, the minimum value, slightly smaller than the minimum value, slightly higher than the minimum value, normal value, maximum value, slightly higher than the maximum value, slightly lower than the maximum value, and other seven elements. Perform Cartesian Product Operations on these sets to generate test cases. As shown in. For programs with N input variables, the number of test cases for robust and worst-case testing is 7 ^ n. 6. Boundary Value test example. 1. Use Case for edge Value Analysis of triangle problems. Test Cases (basic boundary Test Analysis ):
Test Case |
A |
B |
C |
Expected results |
TC1 |
1 |
100 |
100 |
Isosceles triangle |
TC2 |
2 |
100 |
100 |
Isosceles triangle |
TC3 |
199 |
100 |
100 |
Isosceles triangle |
C4 |
200 |
100 |
100 |
Non-Triangle |
TC5 |
100 |
1 |
100 |
Isosceles triangle |
TC6 |
100 |
2 |
100 |
Isosceles triangle |
Tc7 |
100 |
199 |
100 |
Isosceles triangle |
TC8 |
100 |
200 |
100 |
Non-Triangle |
Tc9 |
100 |
100 |
1 |
Isosceles triangle |
Tc10 |
100 |
100 |
2 |
Isosceles triangle |
TC11 |
100 |
100 |
199 |
Isosceles triangle |
Tc12 |
100 |
100 |
200 |
Isosceles triangle |
Tc13 |
100 |
100 |
100 |
Equilateral triangle |
2. Write the worst case test case for the nextdate function.
- Condition: L ≤ month ≤ 12; 1 ≤ date ≤ 31; 1812 ≤ year ≤ 2012
- Values of months (2012, 12), dates (, 31), and years)
- There are 5x5x5 = 125 test cases after the Cartesian product of the three variables. (Omitted test case table ).