一句话:首次将信息检索用于单元测试断言生成,并提出与深度学习结合的集成方法,效果优于纯深度学习基线。
单元测试可用于验证软件基本单元的正确性,但人工编写测试用例与断言成本较高。已有工具可自动生成测试输入与测试预言,其中 ATLAS 等基于深度学习的方法虽具前景但效果仍有限。本文首次尝试将信息检索引入断言生成,提出基于 IR 的断言检索与检索断言适配技术,并进一步提出将 IR 方法与深度学习(如 ATLAS)相结合的集成方案。实验结果表明,IR 方法优于当前最佳的深度学习断言生成方法,且 IR 与深度学习集成后可获得更高准确率。结果说明,对于断言生成等软件工程任务,信息检索方法具有竞争力,值得研究社区认真考虑。
Unit testing could be used to validate the correctness of basic units of the software system under test. To reduce manual efforts in conducting unit testing, the research community has contributed with tools that automatically generate unit test cases, including test inputs and test oracles (e.g., assertions). Recently, ATLAS, a deep learning (DL) based approach, was proposed to generate assertions for a unit test based on other already written unit tests. Despite promising, the effectiveness of ATLAS is still limited. To improve the effectiveness, in this work, we make the first attempt to leverage Information Retrieval (IR) in assertion generation and propose an IR-based approach, including the technique of IR-based assertion retrieval and the technique of retrieved-assertion adaptation. In addition, we propose an integration approach to combine our IR-based approach with a DL-based approach (e.g., ATLAS) to further improve the effectiveness. Our experimental results show that our IR-based approach outperforms the state-of-the-art DL-based approach, and integrating our IR-based approach with the DL-based approach can further achieve higher accuracy. Our results convey an important message that information retrieval could be competitive and worthwhile to pursue for software engineering tasks such as assertion generation, and should be seriously considered by the research community given that in recent years deep learning solutions have been over-popularly adopted by the research community for software engineering tasks.
@inproceedings{YuLSR00L0W22,
title = {Automated assertion generation via information retrieval and its integration with deep learning},
author = {Hao Yu and Yiling Lou and Ke Sun and Dezhi Ran and Tao Xie and Dan Hao and Ying Li and Ge Li and Qianxiang Wang},
booktitle = {ICSE},
year = {2022},
doi = {10.1145/3510003.3510149}
}