论文标题

生成文档的单元测试

Generating Unit Tests for Documentation

论文作者

Nassif, Mathieu, Hernandez, Alexa, Sridharan, Ashvitha, Robillard, Martin P.

论文摘要

软件项目以各种工件的方式捕获信息,包括源代码,测试和文档。这样的工件通常编码冗余的信息,即,当源代码中编码的规范也会单独测试和记录时。在没有支持技术的情况下,这种冗余很容易导致不一致和文档质量的退化。我们设计了一种称为dscribe的工具支持的技术,它利用测试和文档之间的冗余,以基于单个信息来源生成一致且可检查的文档和单位测试。 DScribe根据新型模板和人工制品生成技术生成单元测试和文档片段。通过配对测试和文档生成,DSCribe提供了一种自动检测和替换过时的文档的机制。我们对Apache Commons IO库的评估表明,在有关异常处理的835个规格中,其中85%未经测试或正确记录,并且DSCRIBE可用于自动生成97%的测试和文档。

Software projects capture information in various kinds of artifacts, including source code, tests, and documentation. Such artifacts routinely encode information that is redundant, i.e., when a specification encoded in the source code is also separately tested and documented. Without supporting technology, such redundancy easily leads to inconsistencies and a degradation of documentation quality. We designed a tool-supported technique, called DScribe, that leverages redundancy between tests and documentation to generate consistent and checkable documentation and unit tests based on a single source of information. DScribe generates unit tests and documentation fragments based on a novel template and artifact generation technology. By pairing tests and documentation generation, DScribe provides a mechanism to automatically detect and replace outdated documentation. Our evaluation of the Apache Commons IO library revealed that of 835 specifications about exception handling, 85% of them were not tested or correctly documented, and DScribe could be used to automatically generate 97% of the tests and documentation.

扫码加入交流群

加入微信交流群

微信交流群二维码

扫码加入学术交流群,获取更多资源