Property-based testing is a mainstay of functional programming, boasting a rich literature, an enthusiastic user community, and an abundance of tools~ -- so many, indeed, that new users may have difficulty choosing. Moreover, any given framework may support a variety of strategies for generating test inputs; even experienced users may wonder which are better in any given situation. Sadly, the PBT literature, though long on creativity, is short on rigorous comparisons to help answer such questions. We present ETNA, a platform for empirical evaluation and comparison of PBT techniques. ETNA incorporates a number of popular PBT frameworks and testing workloads from the literature, and its extensible architecture makes adding new ones easy, while handling the technical drudgery of performance measurement. To illustrate its benefits, we use ETNA to carry out several experiments with popular PBT approaches in Rocq, Haskell, OCaml, Racket, and Rust, allowing users to more clearly understand best practices and tradeoffs.
翻译:基于属性的测试(Property-based testing)是函数式编程的重要支柱,拥有丰富的文献、热情的用户社区以及大量工具——事实上,数量之多以至于新用户可能难以选择。此外,任何给定的框架都可能支持多种生成测试输入的策略,即使是经验丰富的用户也可能困惑于在特定情境下哪种策略更优。遗憾的是,PBT文献虽富有创意,却缺乏严谨的比较研究来解答这些问题。本文提出ETNA,一个用于PBT技术经验评估与比较的平台。ETNA整合了文献中多种流行的PBT框架和测试工作负载,其可扩展架构使得添加新框架变得简便,同时自动处理性能测量的技术繁琐工作。为展示其优势,我们利用ETNA在Rocq、Haskell、OCaml、Racket和Rust中针对主流PBT方法开展了多项实验,帮助用户更清晰地理解最佳实践与权衡取舍。