一句话:提出 EvoSpex,用遗传算法从方法执行与变异的前后状态对中自动学习 Java 方法后置条件断言。
软件可靠性依赖对预期行为的规约,但许多 Java 方法缺少断言式规约,或仅有测试附带的场景特定断言。本文提出 EvoSpex:针对参考式类实现的方法,先执行方法获得合法前/后状态对,再变异这些状态对以产生疑似非法对,然后用遗传算法合成后置条件断言,使其满足合法对并排除非法对。作者在开源 Java 项目基准上评估,并用自动 oracle 评估工具与相关方法比较。结果表明,EvoSpex 生成的后置条件更强、更准确,还能推断已验证类中人工编写丰富后置条件的重要部分,并为由规约自动合成实现的方法重现契约。
Software reliability is a primary concern in the construction of software, and thus a fundamental component in the definition of software quality. Analyzing software reliability requires a specification of the intended behavior of the software under analysis, and at the source code level, such specifications typically take the form of assertions. Unfortunately, software many times lacks such specifications, or only provides them for scenario-specific behaviors, as assertions accompanying tests. This issue seriously diminishes the analyzability of software with respect to its reliability. In this paper, we tackle this problem by proposing a technique that, given a Java method, automatically produces a specification of the method's current behavior, in the form of postcondition assertions. This mechanism is based on generating executions of the method under analysis to obtain valid pre/post state pairs, mutating these pairs to obtain (allegedly) invalid ones, and then using a genetic algorithm to produce an assertion that is satisfied by the valid pre/post pairs, while leaving out the invalid ones. The technique, which targets in particular methods of reference-based class implementations, is assessed on a benchmark of open source Java projects, showing that our genetic algorithm is able to generate post-conditions that are stronger and more accurate, than those generated by related automated approaches, as evaluated by an automated oracle assessment tool. Moreover, our technique is also able to infer an important part of manually written rich postconditions in verified classes, and reproduce contracts for methods whose class implementations were automatically synthesized from specifications.
DOI 原文 · arXiv · PDF(开放获取) · DBLP
@inproceedings{abs-2102-13569,
title = {EvoSpex: An Evolutionary Algorithm for Learning Postconditions},
author = {Facundo Molina and Pablo Ponzio and Nazareno Aguirre and Marcelo Frias},
booktitle = {ICSE},
year = {2021},
doi = {10.1109/icse43902.2021.00112}
}