SOFTWARE—PRACTICE AND EXPERIENCE, VOL. 21(10). 1075–1102 (OCTOBER 1991) Path Testing of Computer Programs with Loops using a Tool for Simple Loop Patterns LEE J. WHITE Department of Computer Engineering and Science, Case Western Reserve University, Cleveland, Ohio 44106, U.S.A. AND BOGDAN WISZNIEWSKI Department of Computer Science, Bradley University, Peoria, Illinois 61625, U.S.A. SUMMARY The purpose of this paper is to present a method for testing computer programs with iteration loops. Given such programs, we have shown that for classes of program paths, identified as sequences of simple loop paths, there is a characterizing function called a simple loop pattern. The key idea of simple loop patterns is that these special functions form a base set which can represent any path computation in the given program. A software tool called SILOP has been developed to automatically generate these simple loop patterns, and each corresponding sequence of simple loop paths can be considered as a test case. The tester uses each test case, and with knowledge of the application program, can generate corresponding test data. This paper also presents a method for selecting the specific paths and test data to determine the simple loop pattern reliably. The tester can use this selection method to predict the number of tests required. In order to apply this selection method, the given program must be a linear computer program. The SILOP tool and this test selection method have been applied to commercial software; in this paper, this computational experience is reported and several examples are given to demonstrate the approach. KEY WORDS Software testing Iteration loops Computer program testing Software validation Simple loop patterns INTRODUCTION Path analysis is a useful strategy for planning and executing tests for computer programs. 1–3 There are two major problems in applying this strategy in practice. The first problem is that of determining program path feasibility; as shown in Reference 4, this problem is not solvable in general. The second problem involves the analysis of programs with iteration loops. The purpose of this paper is to analyse iteration loops, and a testing method is proposed based on this analysis. A number of authors 1–3 have suggested approaches to deal with iteration loops, but these approaches are all ad hoc in nature. For example, a typical testing approach for an iteration loop is to choose tests which skip the loop entirely, iterate the loop exactly once, and iterate the loop twice (or some other number of times). When does this approach constitute a reliable test for the effects of an iteration loop, and when is a critical test omitted? An analysis of 0038–0644/91/101075–28$14.00 Received 3 January 1990 © 1991 by John Wiley & Sons, Ltd. Revised 16 April 1991