Fault localization (FL) analyzes the execution information of a test suite to pinpoint the root cause of a failure. The class imbalance of a test suite, i.e., the imbalanced class proportion between passing test cases (i.e., majority class) and failing ones (i.e., minority class), adversely affects FL effectiveness. To mitigate the effect of class imbalance in FL, we propose CGAN4FL: a data augmentation approach using Context-aware Generative Adversarial Network for Fault Localization. Specifically, CGAN4FL uses program dependencies to construct a failure-inducing context showing how a failure is caused. Then, CGAN4FL leverages a generative adversarial network to analyze the failure-inducing context and synthesize the minority class of test cases (i.e., failing test cases). Finally, CGAN4FL augments the synthesized data into original test cases to acquire a class-balanced dataset for FL. Our experiments show that CGAN4FL significantly improves FL effectiveness, e.g., promoting MLP-FL by 200.00%, 25.49%, and 17.81% under the Top-1, Top-5, and Top-10 respectively.
翻译:故障定位(FL)通过分析测试套件的执行信息来定位故障的根本原因。测试套件的类不平衡问题,即通过测试用例(多数类)与失败测试用例(少数类)之间的不平衡类比例,会严重影响FL的有效性。为了缓解FL中类不平衡的影响,我们提出CGAN4FL:一种基于上下文感知生成对抗网络的数据增强方法用于故障定位。具体而言,CGAN4FL利用程序依赖关系构建故障诱发上下文,揭示故障是如何被引发的。然后,CGAN4FL借助生成对抗网络分析该故障诱发上下文,并合成少数类测试用例(即失败测试用例)。最后,CGAN4FL将合成数据扩充到原始测试用例中,获得用于FL的类平衡数据集。实验表明,CGAN4FL显著提升了FL的有效性,例如在Top-1、Top-5和Top-10指标上分别将MLP-FL的性能提升了200.00%、25.49%和17.81%。