Beginner's Luck:一种基于属性的生成器语言
Beginner's Luck: A Language for Property-Based Generators
摘要:
基于属性的随机测试需要为满足复杂逻辑谓词的良好分布的随机数据构建高效的生成器,但是编写这些生成器可能很困难并且容易出错。我们提出了一种特定于域的语言,在该语言中,生成器可以方便地通过用轻量级注释装饰谓词来表示,以控制生成值的分布和每个变量实例化之前发生的约束求解量。这种语言称为Luck,使生成器更容易编写,阅读和维护。我们给运气一个正式的语义和证明几个基本属性,包括健全性和完整性的随机生成相对于一个标准的谓词语义。我们从基于属性的测试文献和两个重要的案例研究的常见例子评估运气,表明它可以用于复杂的领域,具有可比的错误发现的有效性和显着减少测试代码的大小相比,手写发电机。
英文摘要:
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.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。