We've Got You Covered: Type-Guided Repair of Incomplete Input Generators
By: Patrick LaFontaine , Zhe Zhou , Ashish Mishra and more
Potential Business Impact:
Fixes code that makes test inputs for programs.
Property-based testing is a popular technique for automatically testing semantic properties of a program, specified as a pair of pre- and post-conditions. The efficacy of this approach depends on being able to quickly generate inputs that meet the precondition, in order to maximize the set of program behaviors that are probed. For semantically rich preconditions, purely random generation is unlikely to produce many valid inputs; when this occurs, users are forced to manually write their own specialized input generators. One common problem with handwritten generators is that they may be \emph{incomplete}, i.e.,\ they are unable to generate some values meeting the target precondition. This paper presents a novel program repair technique that patches an incomplete generator so that its range includes every valid input. Our approach uses a novel enumerative synthesis algorithm that leverages the recently developed notion of \emph{coverage types} to characterize the set of missing test values as well as the coverage provided by candidate repairs. We have implemented a repair tool for OCaml input generators, called Cobb, and have used it to repair a suite of benchmarks drawn from the property-based testing literature.
Similar Papers
Type-Based Incorrectness Reasoning
Programming Languages
Finds bugs in computer programs automatically.
The Search for Constrained Random Generators
Programming Languages
Creates smart testers for computer programs.
Tuning Random Generators: Property-Based Testing as Probabilistic Programming
Programming Languages
Finds software bugs much faster.