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
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.