一句话:提出 RLTT,用源自单个测试目标(如特定分支或变异体)的奖励信号优化小语言模型,生成目标导向的单元测试。
单元测试对软件可靠性至关重要,但人工编写耗时,因而催生自动化测试生成。小语言模型(SLM)比大模型更高效且隐私友好,却在覆盖率与缺陷检测上不足。已有强化学习方法依赖套件级奖励信号,聚合了所有生成测试的贡献,反馈过于粗糙,模型难以习得覆盖特定分支或杀死特定变异体等针对性行为。为此,本文提出 RLTT(Reinforcement Learning from Testing Targets):借鉴基于搜索的软件测试思想,用源自单个测试目标的奖励信号优化 SLM,并在真实应用上实证研究不同目标级奖励设计与强化学习算法如何塑造目标导向的测试行为,预期产出原则性优化框架、奖励设计准则与面向特定目标的专用 SLM。
Unit tests are essential for software reliability, yet their manual construction is time-consuming, motivating automated test generation. To support this task, Small Language Models (SLMs) have been examined as a more efficient and privacy-preserving alternative to larger models, though they often fall short in coverage and fault detection. Recent reinforcement-learning approaches address this limitation, but their effectiveness remains constrained by the use of suite-level reward signals that aggregate the contributions of all generated tests. This coarse feedback limits the model’s ability to learn targeted testing behaviors, such as exercising specific branches or killing individual mutants. To address these issues, we introduce Reinforcement Learning from Testing Targets (RLTT), a target-driven formulation in which SLMs are optimized using reward signals derived from individual testing goals, inspired by search-based software testing. We will study how different target-level reward designs and reinforcement learning algorithms shape the acquisition of goal-directed testing behaviors through an empirical evaluation on real-world applications. The expected contributions include a principled framework for optimizing models for target-driven test generation, guidelines for designing reward signals that capture partial or complete goal achievement, and specialized SLMs capable of generating effective tests for specific targets.