arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2005.08750cs.SE
收藏

为文档生成单元测试

Generating Unit Tests for Documentation

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

摘要:

软件项目捕获各种工件中的信息,包括源代码、测试和文档。这样的伪像通常编码冗余的信息,即,当编码在源代码中的规范也被单独测试和记录时。如果没有技术支持,这种重复很容易导致不一致和文件质量下降。我们设计了一种工具支持的技术,称为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.

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

↑