[论文解读] Fault Localization with Code Coverage Representation Learning
该论文提出 DeepRL4FL,一种深度学习方法,通过利用代码覆盖率表征学习、语句依赖关系和源代码表征,将故障定位问题视为图像模式识别问题。该方法实现了最先进性能,在现有语句级基线上故障定位准确率提升 491.7%,在方法级基线上提升 206.3%。
In this paper, we propose DeepRL4FL, a deep learning fault localization (FL) approach that locates the buggy code at the statement and method levels by treating FL as an image pattern recognition problem. DeepRL4FL does so via novel code coverage representation learning (RL) and data dependencies RL for program statements. Those two types of RL on the dynamic information in a code coverage matrix are also combined with the code representation learning on the static information of the usual suspicious source code. This combination is inspired by crime scene investigation in which investigators analyze the crime scene (failed test cases and statements) and related persons (statements with dependencies), and at the same time, examine the usual suspects who have committed a similar crime in the past (similar buggy code in the training data). For the code coverage information, DeepRL4FL first orders the test cases and marks error-exhibiting code statements, expecting that a model can recognize the patterns discriminating between faulty and non-faulty statements/methods. For dependencies among statements, the suspiciousness of a statement is seen taking into account the data dependencies to other statements in execution and data flows, in addition to the statement by itself. Finally, the vector representations for code coverage matrix, data dependencies among statements, and source code are combined and used as the input of a classifier built from a Convolution Neural Network to detect buggy statements/methods. Our empirical evaluation shows that DeepRL4FL improves the top-1 results over the state-of-the-art statement-level FL baselines from 173.1% to 491.7%. It also improves the top-1 results over the existing method-level FL baselines from 15.0% to 206.3%.
研究动机与目标
- 解决基于谱的和基于变异的故障定位方法的局限性,这些方法无法区分同时在通过和失败测试用例中执行的语句。
- 克服现有深度学习故障定位方法的不足,这些方法依赖汇总的可疑度分数而非完整的代码覆盖率模式。
- 通过整合动态代码覆盖率信息与静态代码表征及数据依赖关系,提升故障定位准确率。
- 通过在增强的代码覆盖率矩阵上端到端应用深度学习,实现在语句级和方法级更有效的故障定位。
- 利用历史错误数据和程序结构,提升对细微或复杂错误的泛化能力与检测能力。
提出的方法
- 重新排列代码覆盖率矩阵中的测试用例,将执行相似语句的测试用例分组,以增强 CNN 处理所需的空域模式。
- 对重新排列后的代码覆盖率矩阵应用表征学习,提取用于区分故障语句与非故障语句的判别性特征。
- 利用执行和数据流信息建模语句之间的数据依赖关系,以在覆盖率之外丰富可疑度分数。
- 使用静态程序结构学习源代码的向量表征,以补充动态覆盖率和依赖关系特征。
- 将代码覆盖率表征、依赖关系表征和源代码表征融合为统一输入,输入至 CNN 分类器。
- 训练卷积神经网络,基于融合后的表征输入,将语句和方法分类为有错或无错。
实验结果
研究问题
- RQ1与传统基于谱的方法相比,对代码覆盖率矩阵进行深度表征学习是否能提升故障定位准确率?
- RQ2当与代码覆盖率模式结合时,语句之间的数据依赖关系在多大程度上能提升故障定位效果?
- RQ3将静态代码表征与动态覆盖率和依赖特征结合,对故障定位性能有何影响?
- RQ4在增强的代码覆盖率矩阵上训练的基于 CNN 的模型是否能超越现有最先进故障定位技术?
- RQ5该方法在不同编程语言和故障类型(尤其是罕见或复杂错误)上的表现如何?
主要发现
- 在 Defects4J 数据集上,DeepRL4FL 相比最佳语句级基线,将 top-1 故障定位准确率提升了 491.7%。
- 在 ManyBugs 数据集上,DeepRL4FL 实现了 14.6% 的 top-1 准确率,显著优于现有语句级基线。
- 在方法级故障定位方面,DeepRL4FL 在 Defects4J 上实现了 62.0% 的 top-1 准确率,相比现有方法级基线提升了 206.3%。
- 模型性能对测试用例质量敏感;当测试用例稀疏或崩溃位置远离故障代码时,性能下降。
- 该方法在需要添加语句的故障上表现不佳,所有基线方法均存在此局限,表明其在处理代码结构变更方面存在不足。
- 由于语句依赖关系不足,模型在短方法上的表现较差,凸显了程序结构在表征学习中的重要性。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。