一句话:Zest 将 QuickCheck 式随机生成器转为参数化生成器,并用覆盖率和有效性反馈引导语义分析阶段的模糊测试。
程序处理结构化输入时常分语法分析和语义分析两阶段。QuickCheck 式生成器能产生语法合法的随机输入,却难以深入语义分析。Zest 将随机输入生成器转为确定性参数化生成器,利用无类型参数变异对应输入结构变异这一洞见,结合代码覆盖率与输入合法性反馈,进行反馈导向参数搜索。作者在 Maven、Ant、BCEL、Closure、Rhino 五个 Java 程序上与 AFL 和 QuickCheck 对比。Zest 在语义分析阶段覆盖的分支数为基线的 1.03–2.81 倍,并发现 10 个新缺陷,且能可靠、快速地复现,平均每个缺陷最多 10 分钟。
Programs expecting structured inputs often consist of both a syntactic analysis stage, which parses raw input, and a semantic analysis stage, which conducts checks on the parsed input and executes the core logic of the program. Generator-based testing tools in the lineage of QuickCheck are a promising way to generate random syntactically valid test inputs for these programs. We present Zest, a technique which automatically guides QuickCheck-like random input generators to better explore the semantic analysis stage of test programs. Zest converts random-input generators into deterministic parametric input generators. We present the key insight that mutations in the untyped parameter domain map to structural mutations in the input domain. Zest leverages program feedback in the form of code coverage and input validity to perform feedback-directed parameter search. We evaluate Zest against AFL and QuickCheck on five Java programs: Maven, Ant, BCEL, Closure, and Rhino. Zest covers 1.03x-2.81x as many branches within the benchmarks' semantic analysis stages as baseline techniques. Further, we find 10 new bugs in the semantic analysis stages of these benchmarks. Zest is the most effective technique in finding these bugs reliably and quickly, requiring at most 10 minutes on average to find each bug.