一句话:通过代码变换暴露封装属性并增强复杂对象断言生成,提升 EvoSuite 自动测试的变异分数。
自动单元测试生成需同时找到覆盖被测类的 API 调用序列并生成验证行为的断言。基于搜索的 EvoSuite 虽能获得高覆盖率,但类可观测性不足常限制其故障发现能力:关键属性未暴露,或复杂对象状态难以断言。该文研究可观测性对 EvoSuite 的影响,并作两项扩展:一是对被测代码进行变换,使封装属性暴露给测试生成器;二是增强 EvoSuite 对复杂对象状态的断言能力。评估显示,这些改进共同显著提高变异分数,表明在测试生成过程中考虑类可观测性至关重要。
Automated unit test generation consists of two complementary challenges: Finding sequences of API calls that exercise the code of a class under test, and finding assertion statements that validate the behavior of the class during execution. The former challenge is often addressed using meta-heuristic search algorithms optimising tests for code coverage, which are then annotated with regression assertions to address the latter challenge, i.e., assertions that capture the states observed during test generation. While the resulting tests tend to achieve high coverage, their fault finding potential is often inhibited by poor or difficult observability of the codebase. That is, relevant attributes and properties may either not be exposed adequately at all, or only in ways that the test generator is unable to handle. In this paper, we investigate the influence of observability in the context of the EvoSuite search-based Java test generator, which we extend in two complementary ways to study and improve observability: First, we apply a transformation to code under test to expose encapsulated attributes to the test generator; second, we address EvoSuite's limited capability of asserting the state of complex objects. Our evaluation demonstrates that together these observability improvements lead to significantly increased mutation scores, underscoring the importance of considering the class observability in the test generation process.
DOI 原文 ·
@inproceedings{paperbot8801,
title = {Increasing the Effectiveness of Automatically Generated Tests by Improving Class Observability},
author = {Geraldine Galindo-Gutierrez and Juan Pablo Sandoval Alcocer and Nicolas Jimenez-Fuentes and Alexandre Bergel and Gordon Fraser},
booktitle = {ICSE},
year = {2025},
doi = {10.1109/icse55347.2025.00156}
}