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{ intend} 功能。 通常以条件表示的 \ textit{ test oracle} 。 通常以条件表示的 \ textit{ test oracle}, 记录单位在特定测试前缀下的预期行为 。 同步功能测试或触角是一个具有挑战性的问题, 因为它需要捕获预定功能, 而不是执行功能功能功能。 在本文中, 我们提议\ totoolName\ (下线{ 内线{ U} 内线 { 内线{ T} 底线{ { { 底线{ { { { 内线{ { { { { { 内线{ { { { { 内线} } } } 功能 功能 功能 。 。 。 是一个基于统一的变压器的神经方法, 一种统一的变动器基法方法, 用来根据特定测试方法来推断出特殊和声明的测试 。 。 我们的方法可以处理具有模糊性或缺失的单位, 。