Gieno Testing : Boundary Value Analysis | ||||||||||||||||||||||||||||||||||||||||||
Boundary value analysis (BVA) is perhaps the best-known functional test technique. Historical evidence demonstrates errors tend to occur near the extreme boundaries of input and/or output values of physical variables. The “single fault” assumption in reliability theory states failures are rarely result from the simultaneous occurrence of two or more faults. Traditional boundary value analysis focuses on input or output values at the extreme boundary conditions of independent physical variables. Boundary value testing does not apply to Boolean or logical variables, and is generally not effective in complex combinations.
The minimum set of BVA tests exercises one independent physical variable at the extreme ranges while other independent physical variables are set at a nominal condition. The traditional approach to boundary value analysis discusses the valid input and/or output values for validation test cases. However, in actual practice boundary value testing also includes the invalid values +/- 1 beyond the valid range of values to examine both validation and falsification conditions (nmax, nmax+1, nmax-1, nmin, nmin-1, nmin +1) as well as one test case for nominal values. Including invalid values in the BVA test case suite tests run-time errors that abort normal execution and ensures proper error handling.
For example, X and Y are independent input variables. The minimum physical value of Y is a, and b is the maximum physical value of Y. The minimum physical value of X is c, and d is the maximum physical value of X. The formula to determine the traditional minimum set of tests is 6n +1, so this example would require 6n +1 = 6(2) + 1 = 13 tests. The set of tests for this example is illustrated in Figure 1 and defined in the table below.
In a feature which only includes 2 independent physical variables “robust” boundary value testing is reasonably achievable. However, applying “robust” testing to the Triangle problem in which 3 independent physical variables are However, numerous case studies at Microsoft and within the industry clearly demonstrate testing all possible combinations is unlikely to reveal any errors or changes in functionality beyond a carefully constructed array of combinations using orthogonal arrays or pair-wise testing analysis and expert knowledge. Bj’s BVA Reduction Theory Binder [2] states “Some kinds of externally applied tests may be omitted if equivalent checking is done by assertion.” He also suggests in many cases we can reduce the number of boundary tests “on method arguments that are explicitly checked by pre or post conditions,” and “conditions on looping and recursion with loop invariants and loop variants.” Bj’s BVA reduction theorem states any values within the minimum and maximum boundary values are inclusive of valid equivalence class of all physical values within those boundary values. This theory asserts in most cases a test exercising the minimum +1, maximum -1, or any nominal value would not produce a different result then a test which exercises the minimum and maximum values of that same physical variable. If the probability of subsequent tests is not likely to produce different results then those subsequent tests are probably redundant. In general, omitting the nominal and the maximum -1 value tests does not expose any significant risk. However, there are some conditions in which the minimum +1 value should not be omitted from the BVA test suite. Whittaker [3] points out testers should apply inputs that force default values. For example: if a developer specifies a default size of an array, then a size of 0 (not null) is a legal value. Also, a common mistake occurs when developers do not assign variables an initial value. For example: newBuffer() where the parameter is the initial buffer size testers should not assume that newBuffer() and newBuffer(0) perform the same, even if the documentation claims they are identical. REFERENCES [1] Paul C. Jorgensen, Software Testing: A Craftsman’s Approach | ||||||||||||||||||||||||||||||||||||||||||
转载于:https://www.cnblogs.com/gieno/archive/2009/07/24/1529849.html