当前位置: X-MOL 学术arXiv.cs.SE › 论文详情
Our official English website, www.x-mol.net, welcomes your feedback! (Note: you will need to create a separate account there.)
Neural Unit Test Suggestions
arXiv - CS - Software Engineering Pub Date : 2021-09-20 , DOI: arxiv-2109.09262
Elizabeth Dinella, Shuvendu K. Lahiri, Todd Mytkowicz, Gabriel Ryan

Testing is widely recognized as an important stage of the software development lifecycle. Effective software testing can provide benefits such as documentation, bug finding, and preventing regressions. In particular, unit tests document a unit's \textit{intended} functionality. A \textit{test oracle}, typically expressed as an condition, documents the intended behavior of the unit under a given test prefix. Synthesizing a functional test oracle is a challenging problem, as it has to capture the intended functionality and not the implemented functionality. In this paper, we propose \toolName{} (\underline{N}eural \underline{U}nit \underline{T}est \underline{S}uggestions), a unified transformer-based neural approach to infer both exceptional and assertion test oracles based on the context of the focal method. Our approach can handle units with ambiguous or missing documentations, and even units with a missing implementation. We evaluate our approach on both oracle inference accuracy and functional bug-finding. Our technique improves accuracy by 33\% over existing oracle inference approaches, achieving 96\% overall accuracy on a held out test dataset. Furthermore, we show that when integrated with a automated test generation tool (EvoSuite), our approach finds 54 real world bugs in large-scale Java programs, including \DISTINCTBUGS{} bugs that are not found by any other automated testing method in our evaluation.

中文翻译:

神经单元测试建议

测试被广泛认为是软件开发生命周期的一个重要阶段。有效的软件测试可以提供诸如文档、错误发现和防止回归等好处。特别是,单元测试记录了单元的 \textit{intended} 功能。\textit{test oracle},通常表示为条件,记录给定测试前缀下单元的预期行为。综合功能测试预言机是一个具有挑战性的问题,因为它必须捕获预期的功能而不是实现的功能。在本文中,我们提出了 \toolName{} (\underline{N}eural \underline{U}nit \underline{T}est \underline{S}uggestions),一种统一的基于变换器的神经方法来推断异常和断言基于焦点方法的上下文测试预言机。我们的方法可以处理文档不明确或缺失的单元,甚至是缺少实现的单元。我们在预言机推理准确性和功能错误发现方面评估了我们的方法。与现有的预言机推理方法相比,我们的技术将准确度提高了 33%,在保留的测试数据集上实现了 96% 的总体准确度。此外,我们表明,当与自动化测试生成工具 (EvoSuite) 集成时,我们的方法在大规模 Java 程序中发现了 54 个真实世界的错误,包括我们评估中任何其他自动化测试方法都没有发现的 \DISTINCTBUGS{} 错误. 与现有的预言机推理方法相比,我们的技术将准确度提高了 33%,在保留的测试数据集上实现了 96% 的总体准确度。此外,我们表明,当与自动化测试生成工具 (EvoSuite) 集成时,我们的方法在大规模 Java 程序中发现了 54 个真实世界的错误,包括我们评估中任何其他自动化测试方法都没有发现的 \DISTINCTBUGS{} 错误. 与现有的预言机推理方法相比,我们的技术将准确度提高了 33%,在保留的测试数据集上实现了 96% 的总体准确度。此外,我们表明,当与自动化测试生成工具 (EvoSuite) 集成时,我们的方法在大规模 Java 程序中发现了 54 个真实世界的错误,包括我们评估中任何其他自动化测试方法都没有发现的 \DISTINCTBUGS{} 错误.
更新日期:2021-09-21
down
wechat
bug