利用关系问题教授基于属性的测试
Using Relational Problems to Teach Property-Based Testing
摘要:
内容:QuickCheck的成功导致了许多语言的基于属性的测试(PBT)库的开发,并且该过程越来越受到关注。然而,与常规测试不同,PBT在大学课程中并不普遍。此外,PBT的价值不限于软件测试。形式化方法的日益广泛的使用,以及软件综合的发展,都需要对学生和开发人员进行规格说明书编写艺术方面的训练。我们认为PBT在测试和规范行为之间形成了一个强大的桥梁:它是一种测试形式,测试人员实际上是在编写抽象规范。询问:即使是消息灵通的技术人员也提到很难找到好的激励性例子来使用它。我们正在采取措施填补这一空白。方法和知识:我们发现,使用“关系”的问题-那些输入可能承认多个有效的输出-很容易激励使用PBT。我们还注意到,这样的问题在计算机科学的问题万神殿中很容易获得(例如,许多图和排序算法)。我们已经使用这些几年了,现在教PBT在大学课程。接地:在本文中,我们描述的问题,我们使用和报告的学生?完成他们。我们相信这些问题克服了上述的一些动机问题。我们还表明,学生可以在PBT做得很好,这些问题,这表明这个话题是在他们的能力范围内。在这个过程中,我们引入了一个简单的方法来评估他们的规格的准确性,并用它来表征他们的常见错误。重要性:根据我们的研究结果,我们认为,关系问题是一个未充分利用的激励PBT的例子。我们希望这篇文章能为教育工作者(和开发人员)提供一个这样的问题目录,并提供一个具体的(但不是唯一的)方法来分析PBT的质量。
英文摘要:
Context: The success of QuickCheck has led to the development of property-based testing (PBT) libraries for many languages and the process is getting increasing attention. However, unlike regular testing, PBT is not widespread in collegiate curricula. Furthermore, the value of PBT is not limited to software testing. The growing use of formal methods in, and the growth of software synthesis, all create demand for techniques to train students and developers in the art of specification writing. We posit that PBT forms a strong bridge between testing and the act of specification: it's a form of testing where the tester is actually writing abstract specifications. Inquiry: Even well-informed technologists mention the difficulty of finding good motivating examples for its use. We take steps to fill this lacuna. Approach & Knowledge: We find that the use of "relational" problems -- those for which an input may admit multiple valid outputs -- easily motivates the use of PBT. We also notice that such problems are readily available in the computer science pantheon of problems (e.g., many graph and sorting algorithms). We have been using these for some years now to teach PBT in collegiate courses. Grounding: In this paper, we describe the problems we use and report on students? completion of them. We believe the problems overcome some of the motivation issues described above. We also show that students can do quite well at PBT for these problems, suggesting that the topic is well within their reach. In the process, we introduce a simple method to evaluate the accuracy of their specifications, and use it to characterize their common mistakes. Importance: Based on our findings, we believe that relational problems are an underutilized motivating example for PBT. We hope this paper initiates a catalog of such problems for educators (and developers) to use, and also provides a concrete (though by no means exclusive) method to analyze the quality of PBT.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。