Affiliation:
1. University of Pennsylvania, USA
2. University of Bristol, UK
Abstract
Expert users of property-based testing often labor to craft random generators that encode detailed knowledge about what it means for a test input to be valid and interesting. Fortunately, the fruits of this labor can also be put to other uses. In the bidirectional programming literature, for example, generators have been repurposed as validity checkers, while Python's Hypothesis library uses the same structures for shrinking and mutating test inputs.
To unify and generalize these uses and many others, we propose reflective generators, a new foundation for random data generators that can "reflect" on an input value to calculate the random choices that could have been made to produce it. Reflective generators combine ideas from two existing abstractions: free generators and partial monadic profunctors. They can be used to implement and enhance the aforementioned shrinking and mutation algorithms, generalizing them to work for any values that can be produced by the generator, not just ones for which a trace of the generator's execution is available. Beyond shrinking and mutation, reflective generators generalize a published algorithm for example-based generation, and they can also be used as checkers, partial value completers, and other kinds of test data producers.
Funder
National Science Foundation
Engineering and Physical Sciences Research Council
Publisher
Association for Computing Machinery (ACM)
Subject
Safety, Risk, Reliability and Quality,Software
Reference43 articles.
1. NAUTILUS: Fishing for Deep Bugs with Grammars
2. Rudy Matela Braquehais. 2017. Tools for Discovery Refinement and Generalization of Functional Properties by Enumerative Testing. Oct. http://etheses.whiterose.ac.uk/19178/ Publisher: University of York
3. PL and HCI
4. Functional programming for modular Bayesian inference
5. QuickCheck
Cited by
2 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献
1. Property-Based Testing in Practice;Proceedings of the IEEE/ACM 46th International Conference on Software Engineering;2024-04-12
2. Reconciling Partial and Local Invertibility;Lecture Notes in Computer Science;2024