1. Generating Unit Tests for Documentation
- Author
-
Ashvitha Sridharan, Martin P. Robillard, Alexa Hernandez, and Mathieu Nassif
- Subjects
FOS: Computer and information sciences ,Source code ,Computer science ,media_common.quotation_subject ,02 engineering and technology ,Artifact (software development) ,Computer Science - Software Engineering ,Documentation ,Software ,0202 electrical engineering, electronic engineering, information engineering ,Redundancy (engineering) ,media_common ,D.2.1 ,Unit testing ,D.2.5 ,business.industry ,D.2.7 ,020207 software engineering ,Test (assessment) ,Software Engineering (cs.SE) ,Template ,ComputingMethodologies_DOCUMENTANDTEXTPROCESSING ,Software engineering ,business - Abstract
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.
- Published
- 2022