# Model-Based Test Suite Generation Using Mutation Analysis for Fault Localization
## 3 Model-Based Test-Suite Generation Using Mutation Analysis
### Concept of the Proposed Method  
The test-suite generation method proposed in this study began with the question of whether it is possible to use \"mutation analysis\" to generate test suites that are capable of fault detection and fault localization. The essential aspect of testing techniques that use mutation analysis is that they execute test suites on mutants to predict the results of those test suites [14]. Faults are implemented as artificial defects, and test suites are executed on these faults. Therefore, the test-suite execution results can be predicted, and the test input is adjusted to improve the quality of the test suites. If the search-based technique is combined with mutation analysis, it becomes possible to determine the combinations of test inputs that can kill many mutants using a small number of test suites, and to significantly improve the quality of the test suites [15]. This type of search-based mutation testing is centered around fault detection. However, generating test suites only for fault detection can lead to fault-localization problems. Normally, coverage-based fault-localization techniques, such as mutant coverage or code coverage, find the locations of faults based on the coverage difference between each test suite and a pass/fail determination. If the coverage between passed test suites is similar and the coverage between failed test suites is similar, the technique lacks discrimination power, and it becomes difficult to locate the faults. Table 1 shows an example of insufficient discrimination power in fault localization. \begin{table}
\begin{tabular}{c c c c c c} \hline
**Structural Element** & \(\mathbf{T}_{1}\) & \(\mathbf{T}_{2}\) & \(\mathbf{T}_{3}\) & \(\mathbf{T}_{4}\) & **Tarantula Metric** \\ \hline S\({}_{1}\) & & & \(\bullet\) & \(\bullet\) & & 0.5 \\ S\({}_{2}\) & \(\bullet\) & \(\bullet\) & \(\bullet\) & \(\bullet\) & 0.5 \\ S\({}_{3}\) & \(\bullet\) & & & \(\bullet\) & 0.5 \\ S\({}_{4}\)(faulty) & \(\bullet\) & \(\bullet\) & \(\bullet\) & \(\bullet\) & 0.5 \\ S\({}_{5}\) & \(\bullet\) & & \(\bullet\) & & 0.5 \\ S\({}_{6}\) & & \(\bullet\) & & \(\bullet\) & 0.5 \\ _Result_ & P & P & F & F & \\ \hline \end{tabular}
\end{table} 
Table 1: Example of insufficient fault localization discrimination. Table 1 shows the results of executing \(\mathrm{T_{1}-T_{4}}\) on \(\mathrm{S_{1}-S_{6}}\) and the coverage of each test case. The calculation of the tarantula metric by executing four test cases shows that the tarantula metric is 0.5 for all structural elements. The tarantula metric clearly shows that fault localization did not occur because the passed and failed test cases had similar coverage. For the above reason, test suites with a diverse range of test coverage are required for fault localization. Typically, many test suites are executed, and the coverage is analyzed to ensure that there is sufficient discriminatory power for fault localization. The method proposed in this study aims to improve the test suites so that fault localization is possible using a small number of test suites. A genetic algorithm, which is a search-based technique, is used to generate test suites that cover a diverse range of mutants and to search the problem space based on test input. Figure 2 shows the framework of the proposed method, where the TPs are used to generate state chart test suites. During TP generation, paths for generating test suites are generated and saved in the path pool. Paths with a diverse range of coverage are generated so that they will be advantageous for fault localization. The strategy for path generation is described in Section 3.2. The test data generation module generates the initial solution to the genetic algorithm. The initial test suite set is generated based on the path selected in the path pool. The mutant generator generates mutants so that the test input can be developed based on mutant analysis. Each test suite is evaluated via execution with the mutants, and the genetic algorithm is used to pass good traits to later generations via evolution.