可编程的基于属性的测试
Programmable Property-Based Testing
AI总结:
提出一种基于混合嵌入的深层属性语言,将属性具体化为数据结构并解耦执行,在Rocq和Racket中实现,支持快速原型化多种属性运行器以提升领域特定测试。
摘要:
基于属性的测试(PBT)是一种用于建立软件信心的流行技术,用户编写属性(即可执行规范),测试框架可以在循环中多次检查这些属性。在现代PBT框架中,属性通常以浅嵌入的领域特定语言编写,其定义与测试方式紧密耦合。此类框架通常提供方便的配置选项来自定义测试过程的各个方面,但用户仅限于库作者在开发框架时预见到并允许的内容;如果他们想要更多灵活性,可能需要从头编写新框架。我们提出一种基于混合嵌入的新的、更深的属性语言,称为延迟绑定抽象语法,它将属性具体化为数据结构,并将其与执行它们的属性运行器解耦。我们在Rocq和Racket中实现了该语言,分别利用了依赖类型和动态类型的能力。最后,我们通过快速原型化多种属性运行器来展示这种新方法的灵活性,突出了通过更可编程的测试可以解锁的领域特定测试改进。
英文摘要:
Property-based testing (PBT) is a popular technique for establishing confidence in software, where users write properties -- i.e., executable specifications -- that can be checked many times in a loop by a testing framework. In modern PBT frameworks, properties are usually written in shallowly embedded domain-specific languages, and their definition is tightly coupled to the way they are tested. Such frameworks often provide convenient configuration options to customize aspects of the testing process, but users are limited to precisely what library authors had the prescience to allow for when developing the framework; if they want more flexibility, they may need to write a new framework from scratch. We propose a new, deeper language for properties based on a mixed embedding that we call deferred binding abstract syntax, which reifies properties as a data structure and decouples them from the property runners that execute them. We implement this language in Rocq and Racket, leveraging the power of dependent and dynamic types, respectively. Finally, we showcase the flexibility of this new approach by rapidly prototyping a variety of property runners, highlighting domain-specific testing improvements that can be unlocked by more programmable testing.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。