Test generation for higher-order functions in dynamic languages
Open Access
- 24 October 2018
- journal article
- research article
- Published by Association for Computing Machinery (ACM) in Proceedings of the ACM on Programming Languages
- Vol. 2 (OOPSLA) , 1-27
Abstract
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.Keywords
This publication has 57 references indexed in Scilit:
- QuickCheckACM SIGPLAN Notices, 2011
- On the number and nature of faults found by random testingSoftware Testing, Verification and Reliability, 2011
- Adaptive Random Testing: The ART of test case diversityJournal of Systems and Software, 2010
- Type Analysis for JavaScript2009
- DARTACM SIGPLAN Notices, 2005
- Symstra: A Framework for Generating Object-Oriented Unit Tests Using Symbolic Execution2005
- JCrasher: an automatic robustness tester for JavaSoftware: Practice and Experience, 2004
- Adaptive Random Testing2004
- On comparisons of random, partition, and proportional partition testingIEEE Transactions on Software Engineering, 2001
- Symbolic execution and program testingCommunications of the ACM, 1976