一句话:提出基于随机森林的纯方法识别工具 MetPurity,用程序分析自动标注训练集并预测未知方法纯度。
在面向对象程序中,若调用方法不改变调用前已存在对象状态,则该方法为纯方法。纯方法可用于测试生成、编译优化和程序修复,但受源码依赖影响,完全准确识别不可行,现有 ReImInfer 等只能识别部分精确结果并将其余标为未知。本文设计并实现 MetPurity:先对项目内方法用自动程序分析生成带标签训练集,再训练随机森林二分类器,预测同一项目中未知方法的纯度。在四个开源 Java 项目上的初步评估表明,MetPurity 能以较低错误率给出纯方法列表,并用于 EvoSuite 后增加回归测试生成的断言数量。
In object-oriented programming, a method is pure if calling the method does not change object states that exist in the pre-states of the method call. Pure methods are widely-used in automatic techniques, including test generation, compiler optimization, and program repair. Due to the source code dependency, it is infeasible to completely and accurately identify all pure methods. Instead, existing techniques such as ReImInfer are designed to identify a subset of accurate results of pure method and mark the other methods as unknown ones. In this paper, we designed and implemented MetPurity, a learning-based tool of pure method identification. Given all methods in a project, MetPurity labels a training set via automatic program analysis and builds a binary classifier (implemented with the random forest classifier) based on the training set. This classifier is used to predict the purity of all the other methods (i.e., unknown ones) in the same project. Preliminary evaluation on four open-source Java projects shows that MetPurity can provide a list of identified pure methods with a low error rate. Applying MetPurity to EvoSuite can increase the number of generated assertions for regression testing in test generation by EvoSuite.
DOI 原文 ·
@inproceedings{paperbot5996,
title = {MetPurity},
author = {Runze Yu and Youzhe Zhang and Jifeng Xuan},
booktitle = {ASE},
year = {2020},
doi = {10.1145/3324884.3415292}
}