Test generation for higher-order functions in dynamic languages

Test generation for higher-order functions in dynamic languages
复制标题

DOI:
10.1145/3276531
复制
发表时间:
2018-10
影响因子:
--
通讯作者:
Marija Selakovic;Michael Pradel;Rezwana Karim;F. Tip
Marija Selakovic;Michael Pradel;Rezwana Karim;F. Tip
中科院分区:
--
文献类型:
--
作者:
Marija Selakovic;Michael Pradel;Rezwana Karim;F. Tip

文献摘要

被引文献

相似文献

事实证明,测试生成可以提供一种识别编程错误的有效方法。不幸的是,当前的测试生成技术受到动态语言中高阶功能的挑战,例如接收回调的JavaScript函数。特别是,现有的测试生成器遭受了静态已知类型签名的不可用,不提供功能或仅提供琐碎的功能作为输入,而忽略了正在测试的代码触发的回调。本文介绍了Lambdatester,这是一种新颖的测试生成器,可解决由动态语言中高阶功能带来的特定问题。该方法自动在测试方法中自动注入哪个参数位置,期望回调,生成并迭代地改善了作为该方法输入的回调函数,并使用新的测试牙文来检查回调功能是否以及如何调用。我们将Lambdatester应用于13个流行的JavaScript库中测试43个高阶功能。该方法检测到13个库中的12个中的意外行为,其中许多库被最先进的测试生成器遗漏。
Test generation has proven to provide an effective way of identifying programming errors. Unfortunately, current test generation techniques are challenged by higher-order functions in dynamic languages, such as JavaScript functions that receive callbacks. In particular, existing test generators suffer from the unavailability of statically known type signatures, do not provide functions or provide only trivial functions as inputs, and ignore callbacks triggered by the code under test. This paper presents LambdaTester, a novel test generator that addresses the specific problems posed by higher-order functions in dynamic languages. The approach automatically infers at what argument position a method under test expects a callback, generates and iteratively improves callback functions given as input to this method, and uses novel test oracles that check whether and how callback functions are invoked. We apply LambdaTester to test 43 higher-order functions taken from 13 popular JavaScript libraries. The approach detects unexpected behavior in 12 of the 13 libraries, many of which are missed by a state-of-the-art test generator.