## 3 The Proposed Approach
### Test Data Generator Module  
Test-data generation in software testing identifies a set of program input data that satisfy a given test-coverage criterion. This phase uses the GA algorithm [17] to generate test cases to cover all def-use pairs of the given program or its mutant. Then, the tested program is executed with the test cases generated by the GA.  
To apply the concepts of GAs to the problem of test-data creation, the GAs-based test-data generation techniques perform the following tasks:  
* Consider the population to be sets of test data (test suite). Each set of test data is represented by a binary string called a chromosome. * Find the sets of test data that represent the initial population. These sets can be randomly generated according to the format and type of data used by the program under test, or they may be input to the GAs. * Determine the fitness of each individual in the population, which is based on a fitness function that is problem dependent. * Select two individuals that will be combined in some way to contribute to the next generation. * Apply the crossover and mutation processes. * The input to this phase includes:
* Instrumented version of the program to be tested. * List of def-use paths to be covered. * Number of program input variables. * Domain and precision of input data. * Population size. * Maximum no. of generations. * Probabilities of crossover and mutation. The output of this phase includes:
* A dynamic analysis report that shows the traversed path(s) and list of covered and uncovered def-use pairs after executing the given program with the test cases generated by the GA.
* Set of test cases (du pairs cover) that cover the def-use paths of the given program, if possible. The GA may fail to find test cases to cover some of the specified def-use paths when they are infeasible (i.e., no test data can be found by the GA to cover them). * Set of test cases (mutants cover) that cover the mutant. The algorithm evaluates each test case by executing the program with it as input and recording the def-use pairs in the program that are covered by this test case. The ratio between the number of covered def-use pairs by this test case to the total number of def-use pairs as a fitness function. \[\text{fitness\_value}\left(\text{v}_{\text{i}}\right)=\frac{\text{no. of def $-$ use pairs covered by v}_{\text{i}}}{\text{total no. of def $-$ use pairs}} \tag{2}\]GA uses a binary vector as a chromosome to represent values of the program input variables x. The length of the vector depends on the required precision and the domain length for each input variable. Suppose we wish to generate test cases for a program of k input variables x\({}_{1}\),..., x\({}_{k}\), and each variable x\({}_{i}\) can take values from a domain \(\mathrm{D_{i}}\) = [a\({}_{i}\), b\({}_{i}\)]. Suppose further that d\({}_{i}\) decimal places are desirable for the values of each variable x\({}_{i}\). To achieve such precision, each domain \(\mathrm{D_{i}}\) should be cut into (b\({}_{i}-\mathrm{a_{i}}\)) \(\cdot\)10\({}^{\mathrm{d_{i}}}\) equal size ranges. Let us denote by m\({}_{i}\) the smallest integer such that (b\({}_{i}-\mathrm{a_{i}}\)) \(\cdot\) 10\({}^{\mathrm{d_{i}}}\)\(\leq\) 2m\({}_{i}\) - 1. Then, a representation having each variable x\({}_{i}\) coded as a binary string of length m clearly satisfies the precision requirement. The mapping from the binary string string\({}_{i}\) into a real number x\({}_{i}\) from the range [a\({}_{i}\), b\({}_{i}\)] is performed by the following formula:  
\[\mathrm{x_{i}}=\mathrm{a_{i}}+\mathrm{x_{i}}^{\prime}\frac{\mathrm{b_{i}}- \mathrm{a_{i}}}{2^{\mathrm{m_{i}}}-1}, \tag{3}\]  
where \(x_{i}^{\prime}\) represents the decimal value of the binary string stringi [17].