arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2107.13296cs.SEcs.AI
收藏

基于失败测试用例相似度的Patch正确性预测

Predicting Patch Correctness Based on the Similarity of Failing Test Cases

University of Luxembourg(卢森堡大学);Huawei(华为)

Haoye Tian, Yinghua Li, Weiguo Pian, Abdoul Kader Kaboré, Kui Liu, Andrew Habib, Jacques Klein, Tegawendé F. Bissyande

摘要:

为了预测补丁的正确性在APR中,我们提出了一个简单的,但新颖的假设如何补丁的行为和失败的测试规范之间的联系可以得出:类似的失败的测试情况下,应该需要类似的补丁。然后,我们提出了BATS,一个无监督学习为基础的系统来预测补丁的正确性,通过检查补丁行为对失败的测试规范。BATS利用代码和补丁的深度表示学习模型:对于给定的失败测试用例,所产生的嵌入用于在搜索历史相似测试用例时计算相似性度量,以识别相关联的应用补丁,然后将其用作评估生成的补丁正确性的代理。在实验中,我们首先验证我们的假设,通过评估地面实况开发补丁是否以相同的方式聚集在一起,其相关的失败测试用例被聚集在一起。然后,在收集了1278个合理补丁的大数据集(由开发人员编写或由32个APR工具生成)后,我们使用BATS来预测正确性:BATS在识别正确补丁时实现了0.557到0.718之间的AUC和0.562到0.854之间的召回率。与以前的工作相比,我们证明了我们的方法在补丁正确性预测方面优于最先进的性能,而不需要与以前的基于机器学习的方法相比的大型标记补丁数据集。虽然BATS是由类似的测试用例的可用性的限制,我们表明,它仍然可以补充现有的方法:结合最近的方法实施监督学习,BATS提高了整体召回检测正确的补丁。最后,我们表明,BATS可以补充国家的最先进的PATCH-SIM动态方法识别正确的补丁APR工具。

英文摘要:

Towards predicting patch correctness in APR, we propose a simple, but novel hypothesis on how the link between the patch behaviour and failing test specifications can be drawn: similar failing test cases should require similar patches. We then propose BATS, an unsupervised learning-based system to predict patch correctness by checking patch Behaviour Against failing Test Specification. BATS exploits deep representation learning models for code and patches: for a given failing test case, the yielded embedding is used to compute similarity metrics in the search for historical similar test cases in order to identify the associated applied patches, which are then used as a proxy for assessing generated patch correctness. Experimentally, we first validate our hypothesis by assessing whether ground-truth developer patches cluster together in the same way that their associated failing test cases are clustered. Then, after collecting a large dataset of 1278 plausible patches (written by developers or generated by some 32 APR tools), we use BATS to predict correctness: BATS achieves an AUC between 0.557 to 0.718 and a recall between 0.562 and 0.854 in identifying correct patches. Compared against previous work, we demonstrate that our approach outperforms state-of-the-art performance in patch correctness prediction, without the need for large labeled patch datasets in contrast with prior machine learning-based approaches. While BATS is constrained by the availability of similar test cases, we show that it can still be complementary to existing approaches: used in conjunction with a recent approach implementing supervised learning, BATS improves the overall recall in detecting correct patches. We finally show that BATS can be complementary to the state-of-the-art PATCH-SIM dynamic approach of identifying the correct patches for APR tools.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑