arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2305.17047cs.SE
收藏

迈向更真实的神经测试预言生成评估

Towards More Realistic Evaluation for Neural Test Oracle Generation

Zhongxin Liu, Kui Liu, Xin Xia, Xiaohu Yang

AI总结:

本文揭示了现有神经测试预言生成评估中前缀来源、指标和基线等不真实设置导致的性能误判,并提出引入排序步骤、Found@K 指标及 TEval+ 评估方法以更真实地衡量和提升 NTOG 方法的成本效益。

摘要:

有效的单元测试有助于保障和提升软件质量,但编写和维护单元测试需要投入大量时间和精力。一个单元测试由测试前缀和测试预言组成。合成测试预言,尤其是功能性预言,是一个公认的难题。近期研究提出利用神经模型生成测试预言,即神经测试预言生成(NTOG),并取得了有前景的结果。然而,经过系统性检查,我们发现现有 NTOG 评估方法中存在一些不恰当的设置。这些设置可能误导对现有 NTOG 方法性能的理解。我们将其总结为:1)从已修复缺陷的程序版本生成测试前缀;2)使用不切实际的指标进行评估;3)缺乏直接的基线方法。在本文中,我们首先研究这些设置对评估和理解 NTOG 方法性能的影响。我们发现:1)从已修复缺陷的程序版本不切实际地生成测试前缀,会使最先进的 NTOG 方法 TOGA 发现的缺陷数量膨胀 61.8%;2)FPR(假阳性率)不是一个切合实际的评估指标,TOGA 的 Precision 仅为 0.38%;3)一个直接的基线方法 NoException——它仅期望不应抛出异常——能够发现 TOGA 所发现缺陷的 61%,且 Precision 是 TOGA 的两倍。此外,我们在现有评估方法中引入了一个额外的排序步骤,并提出名为 Found@K 的评估指标,以更好地衡量 NTOG 方法的成本效益。我们提出一种新颖的无监督排序方法来实例化该排序步骤,显著提升了 TOGA 的成本效益。最终,我们为 NTOG 提出了一种更真实的评估方法 TEval+,并总结了七条经验法则,以推动 NTOG 方法走向实际应用。

英文摘要:

Effective unit tests can help guard and improve software quality but require a substantial amount of time and effort to write and maintain. A unit test consists of a test prefix and a test oracle. Synthesizing test oracles, especially functional oracles, is a well-known challenging problem. Recent studies proposed to leverage neural models to generate test oracles, i.e., neural test oracle generation (NTOG), and obtained promising results. However, after a systematic inspection, we find there are some inappropriate settings in existing evaluation methods for NTOG. These settings could mislead the understanding of existing NTOG approaches' performance. We summarize them as 1) generating test prefixes from bug-fixed program versions, 2) evaluating with an unrealistic metric, and 3) lacking a straightforward baseline. In this paper, we first investigate the impacts of these settings on evaluating and understanding the performance of NTOG approaches. We find that 1) unrealistically generating test prefixes from bug-fixed program versions inflates the number of bugs found by the state-of-the-art NTOG approach TOGA by 61.8%, 2) FPR (False Positive Rate) is not a realistic evaluation metric and the Precision of TOGA is only 0.38%, and 3) a straightforward baseline NoException, which simply expects no exception should be raised, can find 61% of the bugs found by TOGA with twice the Precision. Furthermore, we introduce an additional ranking step to existing evaluation methods and propose an evaluation metric named Found@K to better measure the cost-effectiveness of NTOG approaches. We propose a novel unsupervised ranking method to instantiate this ranking step, significantly improving the cost-effectiveness of TOGA. Eventually, we propose a more realistic evaluation method TEval+ for NTOG and summarize seven rules of thumb to boost NTOG approaches into their practical usages.

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

↑