Neural-MBFL: Improving Mutation-Based Fault Localization by Neural Mutation

Bin Du, Baolong Han, Hengyuan Liu, Zexing Chang, Yong Liu, Xiang Chen · 2024

As a key phase in software testing and debugging, fault localization can significantly influence the efficiency of fixing software faults. Among the various techniques, Mutation-Based Fault Localization (MBFL) is a widely studied fault localization technique that uses mutation analysis to guide the process of localizing faults. However, as the essential input source for MBFL, traditional mutation generates syntactical mutants, which cannot mimic the real faults and may affect the fault localization effectiveness. To address this issue, we resort to a code pre-trained model for program mutation, which is called neural mutation. Neural mutation can generate semantical mutants and even utilize the context information surrounding the mutation position. Based on the neural mutation, we propose Neural-MBFL by utilizing the high-quality mutants generated by neural mutation. To evaluate the effectiveness of Neural- MBFL, we conduct experiments on 393 faulty programs from the Defects4J benchmark. The experiment results show that Neural-MBFL can localize more faults than traditional MBFL in terms of TOP-N (i.e., 9 for TOP-I, 17 for TOP-3 and 18 for TOP-5 on average) and MAP (i.e., 2.32% relative improvement on average). We also analyze the unique faults localized by Neural-MBFL and traditional MBFL. The statistical results show their complementarity. It motivates further analysis into the repair pattern distributions between Neural-MBFL and traditional MBFL to better understand their complementarity. By further comprehensive analysis of the repair pattern distribution, traditional MBFL has advantages in localizing faults related to rule-based code modifications. In contrast, Neural-MBFL has advantages in localizing complex faults requiring deep code comprehension. These findings show that incorporating neural mutation is promising in improving the effectiveness of MBFL.

Read the paper · More papers on PaperTik