Domain Testing
3. Equality boundary
6.6 TEST SELECTION CRITERION 153 A B
C Expected boundary D2, f2 Actual boundary (open with respect to D1) x
x x
D1, f1
Figure 6.13 Tilted boundary (open inequality).
TABLE 6.8 Detection of Boundary Tilt (Open Inequality)
Test Data Actual Output Expected Output Fault Detected
A f2(A) f1(A) Yes
B f2(B) f2(B) No
C f1(C) f1(C) No
comparing the second and the third columns of Table 6.9 we observe that the actual output and the expected output are not identical for data points A and B. Therefore, data pointsAandB reveal the closure boundary fault.
3. Equality Boundary: Sometimes a domain may consist of an equality boundary sandwiched between two open domains, as shown in Figure 6.15, where D1 and D2 are two domains open with respect to their common equality boundary. In this case, to test the common boundary, we choose two ON pointsA
andB on the boundary and two OFF pointsCandD—one in each open domain.
D1, f1 D2, f2 x x A B Actual boundary Expected boundary xC (open with respect to D1)
(closed with respect to D1)
TABLE 6.9 Detection of Closure Error (Open Inequality)
Test Data Actual Output Expected Output Fault Detected
A f1(A) f2(A) Yes
B f1(B) f2(B) Yes
C f2(C) f2(C) No
6.7 SUMMARY
Two kinds of program errors, namelycomputation error anddomain errors, were identified. A computation error occurs when an input value causes the program to execute the correct path, but the program output is incorrect due to a fault in an assignment statement. A domain error occurs when an input value causes the program to execute the wrong path. A program executes a wrong path because of faults in conditional statements. A program can be viewed as an abstract classifier that partitions the input domain into a finite number of subdomains such that a separate program path executes for each input subdomain. Thus, a program is seen to be mapping the input subdomains to its execution paths. Program subdomains can be identified by considering individual paths in the program and evaluating path predicates. Each subdomain, also called domain, is defined by a set of bound- aries. Often input data points would fall in a wrong domain if there are faults in defining domain boundaries, thereby executing the wrong paths. Input domains were characterized by means of a few properties, such asclosed boundary, open boundary,closed domain,open domain,extreme point, andadjacent domain. Next, three kinds of boundary errors, namely,closure error,shifted-boundary error, and
tilted-boundary error, were identified. Given a domain and its boundaries, the con- cept ofONandOFFpoints were explained. Finally, a test selection criterion was defined to choose test points to reveal domain errors. Specifically, the selection criterion is as follows: For each domain and for each boundary, select three points
A,C, andB in anON –OFF– ONsequence.
and associated computation f3
x x x x Open Open
defined by an equality boundary
A B C D D1, D2, DomainD3 f2 f1
LITERATURE REVIEW 155
LITERATURE REVIEW
Since White and Cohen proposed the concept of domain testing in 1978, it has been analyzed and extended in several ways. In 1982, Clarke, Hassell, and Richardson [4] showed that some domain errors go undetected by the White and Cohen strategy. Next, they proposed a strategy, namely the V ×V strategy, to improve domain testing. If a domain border under consideration contains V
vertices, then theV ×V strategy selectsV ON points —oneONpoint as close as possible to each vertex—and V OFF points. TheV OFFpoints are chosen at a uniform distance from the border. Zeil, Afifi, and White [5] introduced a domain testing strategy to detect linear errors in nonlinear predicate functions. A few other variants of domain testing have been proposed by White and Perera [6] and Onoma, Yamaura, and Kobayashi [7].
Zeil [8] considers domain errors that may be caused by faults in arithmetic and simple relational expressions. These expressions are restricted to floating-point or integer computations. Fault detection techniques, called perturbation techniques, are presented to reveal domain errors.
Koh and Liu [9] have presented an approach for generating paths that test both the control flow and the data flow in implementations of communication protocols. The protocols are assumed to be modeled as extended finite-state machines. The path selection approach consists of two steps: (i) select a set of paths to cover a data flow selection criterion and (ii) selectively augment the state transitions in the chosen set of paths with state check sequences so that control flow can be ensured and data flow coverage can be preserved. Augmentation of state transitions is performed by using the concept ofeffective domains.
Jeng and Weyuker [10] have proposed a simplified domain testing strategy that is applicable to arbitrary types of predicates and detects both linear and nonlin- ear errors for both continuous and discrete variable spaces. Moreover, the strategy requires a constant number of test points. That is, the number of test points is independent of the dimension or the type of border or the number of vertices on the border under consideration. Their simplified technique requires us to generate one ON point and oneOFF point for an inequality (i.e.,≤,<,≥, or>) border. For an equality (i.e.,=) or nonequality (i.e.,=) border, oneONand twoOFFtest points are required. The test generation technique requires (i) an ON point to lie on the border, (ii) an OFFpoint to lie outside the border, and (iii) an ON –OFF
pair to be as close to each other as possible. Hajnal and Forgacs [11] have given an algorithm to generate ON –OFFpoints that can be used by the simplified domain testing strategy.
In contrast, the test selection strategy of White and Cohen [3] requires the selection ofN ONpoints in all cases, whereN is the dimension of the input space, and the Clarke, Hassell, and Richardson [4] strategy requires the selection ofV ON
points, whereV is the number of vertices on the border under consideration. Zhao, Lyu, and Min [12] have studied an approach to generateON –OFFtest points for character string predicate borders associated with program paths. They use the idea of program slicing [13] to compute the current values of variables in the
predicates. The same authors have shown in reference [14] that partition testing strategies are relatively ineffective in detecting faults related to small shifts in input domain boundary, and presented a different testing approach based on input domain analysis of specifications and programs.
An elaborate treatment of domain testing can be found in the book by Beizer [15]. Beizer explains how the idea of domains can be used in testing interfaces between program units.
REFERENCES
1. W. E. Howden. Reliability of the Path Analysis Testing Strategy.IEEE Transactions on Software Engineering, September 1976, pp. 208– 215.
2. L. J. White and E. I. Cohen. A Domain Strategy for Computer Program Testing. Paper presented at the IEEE Workshop on Software Testing and Documentation, Fort Lauderdale, FL, 1978, pp. 335– 346.
3. L. J. White and E. I. Cohen. A Domain Strategy for Computer Program Testing.IEEE Transactions on Software Engineering, May 1980, pp. 247– 257.
4. L. Clarke, H. Hassell, and D. Richardson. A Close Look at Domain Testing.IEEE Transactions on Software Engineering, July 1982, pp. 380– 392.
5. S. J. Zeil, F. H. Afifi, and L. J. White. Detection Linear Errors via Domain Testing.ACM Trans- actions on Software Engineering and Methodology, October 1992, pp. 422– 451.
6. L. J. White and I. A. Perera. An Alternative Measure for Error Analysis of the DomainTesting Strategy. InProceedings of the ACM SIGSOFT/IEEE Workshop on Software Testing, Banff, Canada, IEEE Press, New York, 1986, pp. 122– 131.
7. A. K. Onoma, T. Yamaura, and Y. Kobayashi. Practical Approaches to Domain Testing: Improve- ments and Generalization. InProceedings of COMPSAC, Tokyo, IEEE Computer Society Press, Piscataway, NJ, 1987, pp. 291– 297.
8. S. J. Zeil. Perturbation Technique for Detecting Domain Errors.IEEE Transactions on Software Engineering, June 1989, pp. 737– 746.
9. L. S. Koh and M. T. Liu. Test Path Selection Based on Effective Domains. InProceedings of the International Conference on Network Protocols, Boston, IEEE Computer Society Press, Piscataway, NJ, October 1994, pp. 64– 71.
10. B. Jeng and E. J. Weyuker. A Simplified Domain Testing Strategy.ACM Transactions on Software Engineering and Methodology, July 1994, pp. 254– 270.
11. A. Hajnal and I. Forgacs. An Applicable Test Data Generation Algorithm for Domain Errors. InProceedings of the ACM SIGSOFT International Symposium on Software Testing and Analysis, Clearwater Beach, FL, ACM Press, New York, March 1998, pp. 63– 72.
12. R. Zhao, M. R. Lyu, and Y. Min. Domain Testing Based on Character String Predicate. Paper presented at the Asian Test Symposium, Xian, China, IEEE Computer Society Press, Piscataway, NJ, 2003, pp. 96– 101.
13. F. Tip. A Survey of Program Slicing Techniques.Journal of Programming Languages, September 1995, pp. 121– 189.
14. R. Zhao, M. R. Lyu, and Y. Min. A New Software Testing Approach Based on Domain Anal- ysis of Specifications and Programs. In Proceedings of 14th Symposium on Software Reliability Engineering, Colorado, IEEE Computer Society Press, New York, 2003, pp. 60– 70.
15. B. Beizer.Software Testing Techniques, 2nd ed. Van Nostrand Reinhold, New York, 1990.
Exercises
1. Explain what are computation error anddomain error. 2. Give an example of code showing a domain error.
REFERENCES 157