一句话:提出基于精化类型与 must 式欠近似推理的验证方法,确保测试输入生成器覆盖所有可接受输入。
在基于性质的测试(PBT)中,输入生成器应能产生满足函数输入类型与生成器约束的全部可接受元素,但验证其覆盖性通常依赖手工检查和事后运行分析,易错且难以扩展。本文提出一种基于精化类型的验证过程,用于验证测试输入生成器的覆盖性;其核心是将“must 风格”的欠近似推理嵌入类型系统,使类型刻画表达式保证产生的值集合,而非通常的可能产生值集合。作者在支持高阶过程与归纳数据类型的核心语言中形式化了 coverage types,并通过详细评估研究论证了方法的实用性。
Test input generators are an important part of property-based testing (PBT) frameworks. Because PBT is intended to test deep semantic and structural properties of a program, the outputs produced by these generators can be complex data structures, constrained to satisfy properties the developer believes is most relevant to testing the function of interest. An important feature expected of these generators is that they be capable of producingallacceptable elements that satisfy the function’s input type and generator-provided constraints. However, it is not readily apparent how we might validate whether a particular generator’s output satisfies thiscoveragerequirement. Typically, developers must rely on manual inspection and post-mortem analysis of test runs to determine if the generator is providing sufficient coverage; these approaches are error-prone and difficult to scale as generators become more complex. To address this important concern, we present a new refinement type-based verification procedure for validating the coverage provided by input test generators, based on a novel interpretation of types that embeds “must-style” underapproximate reasoning principles as a fundamental part of the type system. The types associated with expressions now capture the set of valuesguaranteedto be produced by the expression, rather than the typical formulation that uses types to represent the set of values an expressionmayproduce. Beyond formalizing the notion ofcoverage typesin the context of a rich core language with higher-order procedures and inductive datatypes, we also present a detailed evaluation study to justify the utility of our ideas.
@article{paperbot1949,
title = {Covering All the Bases: Type-Based Verification of Test Input Generators},
author = {Zhe Zhou and Ashish Mishra and Benjamin Delaware and Suresh Jagannathan},
journal = {Proceedings of the ACM on Programming Languages},
volume = {7},
number = {PLDI},
year = {2023},
doi = {10.1145/3591271}
}