arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2409.00514cs.SE
收藏

示例驱动开发:连接测试与文档的桥梁

Example-driven development: bridging tests and documentation

Oscar Nierstrasz, Andrei Chiş, Tudor Gîrba

AI总结:

本文提出示例驱动开发(EDD),将测试转化为可返回被测对象的示例,使其兼具测试的因果连接性和文档的可读性,并通过嵌入活文档使软件系统具备可解释性。

摘要:

软件系统应当是可解释的,也就是说,它们应当帮助我们在探索、开发或使用系统的过程中回答问题。文本文档是一种非常弱的解释形式,因为它与代码之间没有因果连接,因此很容易过时。另一方面,测试虽然与代码有因果连接,但它们同样是一种弱的解释形式。尽管有些测试编码了有趣的场景,能够回答关于系统如何工作的某些问题,但大多数测试并不具备可读性。示例是同时充当有趣系统实体工厂的测试。示例不是简单地成功或失败,而是返回被测对象,以便可以对其进行检查,或者复用它来组合进一步的测试。示例与系统有因果连接,始终是活跃且经过测试的,并且可以嵌入到活文档中。尽管从技术上讲,示例只是对测试方法工作方式的一个小改动,但它们的潜在影响可能是开创性的。我们展示了:(i) 示例驱动开发(EDD)如何通过活编程来丰富测试驱动开发(TDD);(ii) 如何利用微型工具塑造示例来回答分析问题;以及 (iii) 如何将示例嵌入活文档中,使系统变得可解释。

英文摘要:

Software systems should be explainable, that is, they should help us to answer questions while exploring, developing or using them. Textual documentation is a very weak form of explanation, since it is not causally connected to the code, so easily gets out of date. Tests, on the other hand, are causally connected to code, but they are also a weak form of explanation. Although some tests encode interesting scenarios that answer certain questions about how the system works, most tests don't make interesting reading. Examples are tests that are also factories for interesting system entities. Instead of simply succeeding or failing, an example returns the object under test so that it can be inspected, or reused to compose further tests. An example is causally connected to the system, is always live and tested, and can be embedded into live documentation. Although technically examples constitute just a small change to the way that to test methods work, their impact is potentially ground-breaking. We show (i) how Example-Driven Development (EDD) enriches TDD with live programming, (ii) how examples can be molded with tiny tools to answer analysis questions, and (iii) how examples can be embedded within live documentation to make a system explainable.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑