Beginner's luck: a language for property-based generators
Paper i proceeding, 2017

Property-based random testing a la QuickCheck requires building efficient generators for well-distributed random data satisfying complex logical predicates, but writing these generators can be difficult and error prone. We propose a domain-specific language in which generators are conveniently expressed by decorating predicates with lightweight annotations to control both the distribution of generated values and the amount of constraint solving that happens before each variable is instantiated. This language, called Luck, makes generators easier to write, read, and maintain. We give Luck a formal semantics and prove several fundamental properties, including the soundness and completeness of random generation with respect to a standard predicate semantics. We evaluate Luck on common examples from the property-based testing literature and on two significant case studies, showing that it can be used in complex domains with comparable bug-finding effectiveness and a significant reduction in testing code size compared to handwritten generators.

constraint solving

random testing

property-based testing

domain specific language

narrowing

Författare

Leonidas Lampropoulos

University of Pennsylvania

Diane Gallois-Wong

Ecole Normale Superieure (ENS)

Institut National de Recherche en Informatique et en Automatique (INRIA)

Catalin Hritcu

Institut National de Recherche en Informatique et en Automatique (INRIA)

John Hughes

Programvaruteknik, Grupp A

Benjamin C. Pierce

University of Pennsylvania

Li-yao Xia

Institut National de Recherche en Informatique et en Automatique (INRIA)

Ecole Normale Superieure (ENS)

SIGPLAN Notices (ACM Special Interest Group on Programming Languages)

07308566 (ISSN)

Vol. 52 1 114-129

POPL 2017: 44th ACM SIGPLAN Symposium on Principles of Programming Languages
Paris, France,

Styrkeområden

Informations- och kommunikationsteknik

Fundament

Grundläggande vetenskaper

Ämneskategorier

Programvaruteknik

Datavetenskap (datalogi)

DOI

10.1145/3009837.3009868

Mer information

Senast uppdaterat

2022-06-09