Testing is widely recognized as an important stage of the software development lifecycle. Effective software testing can provide benefits such as bug finding, preventing regressions, and documentation. In terms of documentation, unit tests express a unit's intended functionality, as conceived by the developer. A test oracle, typically expressed as an condition, documents the intended behavior of a unit under a given test prefix. Synthesizing a functional test oracle is a challenging problem, as it must capture the intended functionality rather than the implemented functionality. In this paper, we propose TOGA (a neural method for Test Oracle GenerAtion), 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 documentation, 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 57 real world bugs in large-scale Java programs, including 30 bugs that are not found by any other automated testing method in our evaluation.
翻译:有效的软件测试可以提供错误发现、防止回归和文件等好处。 在文件方面,单位测试可以表达开发者所设想的单位的预期功能。 通常以条件表示的测试神器可以记录特定测试前缀下单位的预期行为。 合成功能测试神器是一个具有挑战性的问题,因为它必须捕捉预期功能而不是执行功能。 在本文中,我们提议TOGA(测试神器的神经法),一个基于统一的变异器的神经法,以根据协调方法的背景来推断特殊和主张测试神器。 我们的方法可以处理模棱两可或缺失文件的单位,甚至处理缺少执行的单位。 我们评估我们关于电弧误判精度和功能错误调查的方法。 我们的技术比现有的测精度方法增加了33 ⁇ 的精确度,在已经保存的测试数据集上达到了96 ⁇ 总精度。 此外,我们显示,当与自动测试产生工具(包括30号系统)结合时,我们的方法可以处理模糊或缺失文件的单位,甚至缺少执行。 我们评估了57号中发现,我们的任何实际测试方法都是世界范围内的大规模测试方法。