@tComment: Testing javadoc comments to detect comment-code inconsistencies

Shin Hwei Tan, Darko Marinov, Lin Tan, Gary T. Leavens

Research output: Chapter in Book/Report/Conference proceedingConference contribution

Abstract

Code comments are important artifacts in software. Javadoc comments are widely used in Java for API specifications. API developers write Javadoc comments, and API users read these comments to understand the API, e.g., reading a Javadoc comment for a method instead of reading the method body. An inconsistency between the Javadoc comment and body for a method indicates either a fault in the body or, effectively, a fault in the comment that can mislead the method callers to introduce faults in their code. We present a novel approach, called @TCOMMENT, for testing Javadoc comments, specifically method properties about null values and related exceptions. Our approach consists of two components. The first component takes as input source files for a Java project and automatically analyzes the English text in Javadoc comments to infer a set of likely properties for a method in the files. The second component generates random tests for these methods, checks the inferred properties, and reports inconsistencies. We evaluated @TCOMMENT on seven open-source projects and found 29 inconsistencies between Javadoc comments and method bodies. We reported 16 of these inconsistencies, and 5 have already been confirmed and fixed by the developers.

Original languageEnglish (US)
Title of host publicationProceedings - IEEE 5th International Conference on Software Testing, Verification and Validation, ICST 2012
Pages260-269
Number of pages10
DOIs
StatePublished - Jun 21 2012
Event5th IEEE International Conference on Software Testing, Verification and Validation, ICST 2012 - Montreal, QC, Canada
Duration: Apr 17 2012Apr 21 2012

Publication series

NameProceedings - IEEE 5th International Conference on Software Testing, Verification and Validation, ICST 2012

Other

Other5th IEEE International Conference on Software Testing, Verification and Validation, ICST 2012
CountryCanada
CityMontreal, QC
Period4/17/124/21/12

    Fingerprint

Keywords

  • comment analysis
  • random testing
  • test generation

ASJC Scopus subject areas

  • Software

Cite this

Tan, S. H., Marinov, D., Tan, L., & Leavens, G. T. (2012). @tComment: Testing javadoc comments to detect comment-code inconsistencies. In Proceedings - IEEE 5th International Conference on Software Testing, Verification and Validation, ICST 2012 (pp. 260-269). [6200082] (Proceedings - IEEE 5th International Conference on Software Testing, Verification and Validation, ICST 2012). https://doi.org/10.1109/ICST.2012.106