Lune

FSE2026顶会

Generalizing Test Cases for Comprehensive Test Scenario Coverage

Binhang Qi, Yun Lin, Xinyi Weng, Chenyan Liu, Hailong Sun, Gordon Fraser, Jin Song Dong

摘要

Test cases are essential for software development and maintenance. In practice, developers derive multiple test cases from an implicit pattern based on their understanding of requirements and inference of diverse test scenarios, each validating a specific behavior of the focal method. However, producing comprehensive tests is time-consuming and error-prone: many important tests that should have accompanied the initial test are added only after a significant delay, sometimes only after bugs are triggered.

Existing automated test generation techniques largely focus on code coverage. Yet in real projects, practical tests are seldom driven by code coverage alone, since test scenarios do not necessarily align with control-flow branches. Instead, test scenarios originate from requirements, which are often undocumented and implicitly embedded in a project's design and implementation. However, developer-written tests are frequently treated as executable specifications; thus, even a single initial test that reflects the developer's intent can reveal the underlying requirement and the diverse scenarios that should be validated.

In this work, we propose TestGeneralizer, a framework for generalizing test cases to comprehensively cover test scenarios. TestGeneralizer orchestrates three stages: (1) enhancing the understanding of the requirement and scenario behind the focal method and initial test; (2) generating a test scenario template and crystallizing it into various test scenario instances; and (3) generating and refining executable test cases from these instances. To ensure accuracy and completeness, TestGeneralizer combines rule-based prompts, automatically optimized via a prompt auto-tuning technique, with crucial project knowledge retrieved through program analysis. We evaluate TestGeneralizer against three state-of-the-art baselines (EvoSuite, gpt-o4-mini, and ChatTester) on 12 open-source Java projects, covering 506 multi-test focal methods and 1,637 test scenarios. TestGeneralizer achieves significant improvements: +57.67% and +59.62% over EvoSuite, +37.44% and +32.82% over gpt-o4-mini, and +31.66% and +23.08% over ChatTester, in mutation-based and LLM-assessed scenario coverage, respectively. In a field study, we submitted 27 generalized tests overlooked by developers; 16 were accepted and merged into official repositories, demonstrating the practical usefulness of TestGeneralizer.

问 Lune

几分钟读透这篇 Paper,不用再花一下午。

Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。

已有 2 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。

可以从这些问题问起

Lune 可以查阅

全文 · 引用它的顶会 Paper · 相关的 Paper

获取答案

免费开始,无需绑卡

脉络

  • CodaMosa: Escaping Coverage Plateaus in Test Generation with Pre-trained Large Language Models 引用了 TOGA: A Neural Method for Test Oracle Generation
  • Evaluating and Improving ChatGPT for Unit Test Generation 引用了 CodaMosa: Escaping Coverage Plateaus in Test Generation with Pre-trained Large Language Models
  • Evaluating and Improving ChatGPT for Unit Test Generation 引用了 TOGA: A Neural Method for Test Oracle Generation
  • Evaluating and Improving ChatGPT for Unit Test Generation 引用了 Fuzz4All: Universal Fuzzing with Large Language Models
  • Evaluating and Improving ChatGPT for Unit Test Generation 引用了 Large Language Models are Few-shot Testers: Exploring LLM-based General Bug Reproduction
  • Fuzz4All: Universal Fuzzing with Large Language Models 引用了 CodaMosa: Escaping Coverage Plateaus in Test Generation with Pre-trained Large Language Models
  • IssueExec: A Test-Driven Approach for Localizing Software Engineering Issues 引用了 Generating Project-Specific Test Cases with Requirement Validation Intention
  • Generating Project-Specific Test Cases with Requirement Validation Intention 引用了 CodaMosa: Escaping Coverage Plateaus in Test Generation with Pre-trained Large Language Models
  • Generating Project-Specific Test Cases with Requirement Validation Intention 引用了 TOGA: A Neural Method for Test Oracle Generation
  • Generating Project-Specific Test Cases with Requirement Validation Intention 引用了 Evaluating and Improving ChatGPT for Unit Test Generation
  • Generating Project-Specific Test Cases with Requirement Validation Intention 引用了 Fuzz4All: Universal Fuzzing with Large Language Models
  • Generating Project-Specific Test Cases with Requirement Validation Intention 引用了 Large Language Models are Few-shot Testers: Exploring LLM-based General Bug Reproduction
它引用的引用它的从左到右按年份排列,引用越多,位置越高。

引用它的顶会 Paper2

  1. Generating Project-Specific Test Cases with Requirement Validation IntentionBinhang Qi, Yun Lin, Xinyi Weng, Yuhuan Huang 等ISSTA 2026 · 3 次引用
  2. IssueExec: A Test-Driven Approach for Localizing Software Engineering IssuesJiawei Liu, Yun Lin, Chenyan Liu, Yu Qian 等ISSTA 2026

它引用的 Paper16

  1. CodaMosa: Escaping Coverage Plateaus in Test Generation with Pre-trained Large Language ModelsCaroline Lemieux, Jeevana Priya Inala, Shuvendu K. Lahiri, Siddhartha SenICSE 2023 · 221 次引用
  2. Large Language Models are Few-shot Testers: Exploring LLM-based General Bug ReproductionSungmin Kang, Juyeon Yoon, Shin YooICSE 2023 · 163 次引用
  3. Fuzz4All: Universal Fuzzing with Large Language ModelsChunqiu Steven Xia, Matteo Paltenghi, Jia Le Tian, Michael Pradel 等ICSE 2024 · 155 次引用
  4. TOGA: A Neural Method for Test Oracle GenerationElizabeth Dinella, Gabriel Ryan, Todd Mytkowicz, Shuvendu K. LahiriICSE 2022 · 92 次引用
  5. Evaluating and Improving ChatGPT for Unit Test GenerationZhiqiang Yuan, Mingwei Liu, Shiji Ding, Kaixin Wang 等FSE 2024 · 89 次引用

相关 Paper

  1. Sakura: An Approach for Generating Complex Tests from Natural Language Test DescriptionsTyler Stennett, Rangeet Pan, Bridget McGinn, Alessandro Orso 等ISSTA 2026
  2. Navigating the Labyrinth: Path-Sensitive Unit Test Generation with Large Language ModelsDianshu Liao, Xin Yin, Shidong Pan, Chao Ni 等ASE 2025 · 2 次引用
  3. Knowledge Matters: Injecting Project and Testing Knowledge into LLM-based Unit Test GenerationAnji Li, Mingwei Liu, Zhenxi Chen, Zheng Pei 等ICSE 2026 · 2 次引用
  4. HITS: High-coverage LLM-based Unit Test Generation via Method SlicingZejun Wang, Kaibo Liu, Ge Li, Zhi JinASE 2024 · 29 次引用
  5. MuMuTestUp: Mutation-Based Multi-agent Test Case UpdateDawei Tian, Jiakun Liu, Yun Peng, Yichen Zhang 等ISSTA 2026
黄昏的海面,两侧是细线勾勒的悬崖