一句话:提出 Jdoctor,结合模式、词汇和语义匹配,将 Javadoc 注释自动翻译为可执行过程规范,并提升测试生成质量。
程序规范在测试生成等任务中很有用,但实践中形式规范稀缺,开发者常用半结构化 Javadoc 注释表达过程规范。本文提出 Jdoctor,融合模式匹配、词汇匹配与语义匹配,把 Javadoc 注释翻译为用 Java 表达式表示的可执行过程规范。实证评估中,Jdoctor 的翻译精确率为 92%,召回率为 83%;将这些规范提供给自动化测试用例生成工具 Randoop 后,Randoop 能生成更高质量的测试用例。
Procedure specifications are useful in many software development tasks. As one example, in automatic test case generation they can guide testing, act as test oracles able to reveal bugs, and identify illegal inputs. Whereas formal specifications are seldom available in practice, it is standard practice for developers to document their code with semi-structured comments. These comments express the procedure specification with a mix of predefined tags and natural language. This paper presents Jdoctor, an approach that combines pattern, lexical, and semantic matching to translate Javadoc comments into executable procedure specifications written as Java expressions. In an empirical evaluation, Jdoctor achieved precision of 92% and recall of 83% in translating Javadoc into procedure specifications. We also supplied the Jdoctor-derived specifications to an automated test case generation tool, Randoop. The specifications enabled Randoop to generate test cases of higher quality.
DOI 原文 ·
@inproceedings{paperbot4841,
title = {Translating code comments to procedure specifications},
author = {Arianna Blasi and Alberto Goffi and Konstantin Kuznetsov and Alessandra Gorla and Michael D. Ernst and Mauro Pezzè and Sergio Delgado Castellanos},
booktitle = {ISSTA},
year = {2018},
doi = {10.1145/3213846.3213872}
}