Breeding Software Test Cases for Pairwise Testing Using GA GJCST Classification Dr
Total Page:16
File Type:pdf, Size:1020Kb
Global Journal of Computer Science and Technology Vol. 10 Issue 4 Ver. 1.0 June 2010 P a g e | 97 Breeding Software Test Cases for Pairwise Testing Using GA GJCST Classification Dr. Rakesh Kumar1 Surjeet Singh2 D.2.5, D.2.12 Abstract- All-pairs testing or pairwise testing is a specification- has improved with testing, it is still not clear to the based combinatorial testing method, which requires that for customers that they are receiving the return of the each pair of input parameters to a system (typically, a software investment they demand. Software testing is an important algorithm), each combination of valid values of these two activity of the software development process. It is a critical parameters be covered by at least one test case [TAI02]. element of software quality assurance. A set of possible Pairwise testing has become an indispensable tool in a software tester’s toolbox. This paper pays special attention to usability of inputs for any software system can be too large to be tested the pairwise testing technique. In this paper, we propose a new exhaustively. Techniques like equivalence class partitioning test generation strategy for pairwise testing using Genetic and boundary-value analysis help convert even a large Algorithm (GA). We compare the result with the random number of test levels into a much smaller set with testing and pairwise testing strategy and find that applying GA comparable defect-detection capability. If software under for pairwise testing performs better result. Information on at test can be influenced by a number of such aspects, least 20 tools that can generate pairwise test cases, have so far exhaustive testing again becomes impracticable. A number been published [PAI10]. Most tools, however, lack practical of combinatorial schemes have been proposed to help testers features necessary for them to be used in industry. Over the choose subsets of input combinations that would maximize years, pairwise testing was shown to be an efficient and effective strategy of choosing tests [BUR98, BUR94, COH97, the possibility of finding errors. Random testing, Anti- DUN97, KUH02, WAL01]. However, as shown by Smith et al. random testing, Adaptive random testing and finally t-wise [SMI00] and later by Bach and Shroeder [BAC04] pairwise, testing strategies with pairwise testing being the most like any technique, needs to be used properly and with caution. famous among these (see Figure 1). Software system testing typically consists of only a very small sample from the set of I. INTRODUCTION possible inputs. It can be difficult or almost impracticable to recent BusinessWeek magazine article, ―Business generalize the test results from a limited amount of testing. It A Software Needs a Revolution‖, describes how can also be very difficult to determine the nature and customers are becoming more concerned with software location of the errors. To address these issues, this paper quality and less interested in ―Bells and Whistles‖. During presents genetic algorithm approach to breed software test the technology boom in the late 90‘s, software development cases for pairwise testing. In this article we investigate the organizations focused largely on features and functionality performance of GA with different parameters combinations for their software and not testing and quality assurance. In used for test data generation. The work is compared with response to customers demand for quality, many software random testing and simple pairwise testing and we testing conference, seminars, training and books have concluded that the GA improves the quality of test suites for emerged in the past seven years. They all emphasize the all-pair testing from one generation to the next, and performs need for a structural testing process and the heavy use of better than random testing, where the search was absolutely software testing tools. Additionally, most companies who random and does not show improvement through the develop software have invested a significant amount of their generations. Another observation is that random testing development budget in software testing. Testing, like all generates less successful test cases than pairwise GA. Test other expenses have been rising. A study conducted by data generation consists in proposing a superior set of input NASA, out of total cost of the software development life data for a program to be tested. This is a very significant, cycle, 6% have been consumed in software requirements, time consuming, and hard task in software development 24% in design (system design and detailed design), 45% in [KOR90]. But, what is a good set of data inputs? Intuitively, coding and unit testing, 5% in acceptance testing and 20% in we can state that a good set of test data will allow a large system testing. Software testing continues after the software amount of faults in a program to be discovered. For a more product goes into production. It is estimated that 30% of an formal definition we have to resort to the test adequacy enterprise‘s IT budget is devoted to the original development criteria [MIC01]. A great number of paradigms have been and 70% is for enhancements and fixing bugs not discovered applied to the test data generation. A first paradigm is so- during original development. While the quality of software called random test data generation. The test data are created _______________________________ randomly until the test adequacy criterion is satisfied or a maximum number of data sets are generated. The second About1-Associate Professor.Deptt. of Computer Sci. & ApplicationKurukshetra University, Kurukshetra (India) paradigm, known as symbolic test data generation [CLA76] (e-mail:[email protected] ) consists in using symbolic values for the variables instead of About2- Assistant Professor .Department of Computer Science G.M.N. real values to get a symbolic execution. Some algebraic College, Ambala Cantt.(India) (e-mail;[email protected]) constraints are obtained from this symbolic execution and P a g e | 98 Vol. 10 Issue 4 Ver. 1.0 June 2010 Global Journal of Computer Science and Technology these constraints are used for finding test cases. Godzilla Legal, Letter), Color (Multicolor, Mono). The total [OFF91] is an automatic test data generator that uses this combinations that need to be tested are 3 operating systems, technique. A third and widely spread paradigm is dynamic 4 web browsers, 2 types of orientations, 3 page sizes and 2 test data generation. In this case, the program is types of color, i.e., 144 (3x4x2x3x2). All-pairs test case instrumented to pass information to the test generator. The generation strategy takes the above input, prepares a list of test generator checks whether the test adequacy criterion is ―all pairs‖ of values from test parameters and packages them fulfilled or not. If the test criterion is not fulfilled it prepares in the least possible number of test cases. In this case only new test sets to serve as input for the program. The test data 13 test cases can be created to cover sufficiently all the pairs. generation process is translated into a function minimization That is the power of pairwise testing. Pairwise testing problem, where the function is some kind of distance to an strategy reportedly reduced the testing efforts and also execution where the test criterion is fulfilled. This paradigm technically achieved more code coverage than usual. The was presented in [MIL76] and there are many works based practical approach is to perform testing on a feature‘s on it [KOR90, MIC01, JON96, WEG97]. Following the pairwise test configurations as well as knowledge based dynamic test data generation paradigm, several configurations. Knowledge-based configurations would metaheuristic techniques have been applied to the problem mean selecting or deselecting the values of the Test in the literature. Mantere and Alander in [MAN05] present a Parameters based on the context. Following is the list of recent review on the applications of the evolutionary matrices gathered with the help of TestersDesk to algorithms to software testing. Most of the papers included demonstrate the capability of pairwise generator. in their discussion use GAs to find test data. In fact, only a SrN ParametersAndVa 100% Coverage ReducedtobyPair few works listed in the review include other techniques such o. lues wise Testing as cultural algorithms [OST99] (a special kind of GA), hill 1 322211 (9x4x1)=36 9 climbing [TRA00], and simulated annealing [TRA98]. We 2 10474836232524 14338695168000 144 have found other recent works applying metaheuristic 291 000 algorithms to software testing. In [DIA03] the authors 3 1015 10000000000000 199 explain how a Tabu Search algorithm can be applied to 00 generate test data obtaining maximum branch coverage. 4 105563525 2430000000000 142 Sagarna and Lozano tackle the problem by using an 5 33425262718210 15676416000 96 Estimation of Distribution Algorithm (EDA) in [SAG03] 191 and they compare a Scatter Search (SS) with EDAs in Figure2: Capability Metrics [SAG05]. In this work we propose the GA for finding input data sets for pairwise testing. This technique has some So with the help of pairwise testing we are able to limit the advantages such as self-adaptability, and real number test cases generated by exhaustive testing strategy. The representation of the problem variables. The former reduces necessary condition for pairwise testing is for each pairs of the human effort in tuning the algorithm. The last makes input parameters every combination of valid values of these possible to explore a wide region of the input values. two parameters be covered. Consider a system with parameters X, Y, Z and values (X1, X2), (Y1, Y2) and (Z1, Z2, Z3) respectively. For parameters X and Y the total number of possible pairwise test cases are limited to {(X1, Y1), (X1, Y2), (X2, Y1), (X2, Y2)} only but for parameters X, Y, Z a large number of pairwise test sets exists.