Lune

ASE2025顶会

Clarifying Semantics of In-Context Examples for Unit Test Generation

Chen Yang, Lin Yang, Ziqi Wang, Dong Wang, Jianyi Zhou, Junjie Chen

摘要

Recent advances in large language models (LLMs) have enabled promising performance in unit test generation through in-context learning (ICL). However, the quality of in-context examples significantly influences the effectiveness of generated tests—poorly structured or semantically unclear test examples often lead to suboptimal outputs. In this paper, we propose CLAST, a novel technique that systematically refines unit tests to improve their semantic clarity, thereby enhancing their utility as in-context examples. The approach decomposes complex tests into logically clearer ones and improves semantic clarity through a combination of program analysis and LLM-based rewriting. We evaluated CLAST on four open-source and three industrial projects. The results demonstrate that CLAST largely outperforms UTgen, the state-of-the-art refinement technique, in both preserving test effectiveness and enhancing semantic clarity. Specifically, CLAST fully retains the original effectiveness of unit tests, while UTgen reduces compilation success rate (CSR), pass rate (PR), test coverage (Cov), and mutation score (MS) by an average of 12.90%, 35.82%, 4.65%, and 5.07%, respectively. Over 85.33% of participants in our user study preferred the semantic clarity of CLAST-refined tests. Notably, incorporating CLAST-refined tests as examples effectively improves ICL-based unit test generation approaches such as RAGGen and TELPA, resulting in an average increase of 25.97% in CSR, 28.22% in PR, and 45.99% in Cov for generated tests, compared to incorporating UTgen-refined tests. The insights from the follow-up user study not only reinforce CLAST’s potential impact in software testing practice but also illuminate avenues for future research.

问 Lune

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

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

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

可以从这些问题问起

Lune 可以查阅

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

免费注册,获取答案

无需绑卡

脉络

  • Reflective Unit Test Generation for Precise Type Error Detection with Large Language Models 引用了 Efficient Memory Management for Large Language Model Serving with PagedAttention
  • Reflective Unit Test Generation for Precise Type Error Detection with Large Language Models 引用了 HITS: High-coverage LLM-based Unit Test Generation via Method Slicing
  • Reflective Unit Test Generation for Precise Type Error Detection with Large Language Models 引用了 Code-Aware Prompting: A Study of Coverage-Guided Test Generation in Regression Setting using LLM
  • Reflective Unit Test Generation for Precise Type Error Detection with Large Language Models 引用了 On the Evaluation of Large Language Models in Unit Test Generation
  • What Makes In-Context Examples Effective for Code Generation? 引用了 Efficient Memory Management for Large Language Model Serving with PagedAttention
  • Characterizing and Mitigating False-Positive Bug Reports in the Linux Kernel 引用了 Reflective Unit Test Generation for Precise Type Error Detection with Large Language Models
  • Characterizing and Mitigating False-Positive Bug Reports in the Linux Kernel 引用了 On the Evaluation of Large Language Models in Unit Test Generation
  • Context Matters: Improving the Practical Reliability of LLM-Based Unit Test Generation (Experience Paper) 引用了 Reflective Unit Test Generation for Precise Type Error Detection with Large Language Models
  • Context Matters: Improving the Practical Reliability of LLM-Based Unit Test Generation (Experience Paper) 引用了 HITS: High-coverage LLM-based Unit Test Generation via Method Slicing
  • Context Matters: Improving the Practical Reliability of LLM-Based Unit Test Generation (Experience Paper) 引用了 On the Evaluation of Large Language Models in Unit Test Generation
  • HITS: High-coverage LLM-based Unit Test Generation via Method Slicing 引用了 Code-Aware Prompting: A Study of Coverage-Guided Test Generation in Regression Setting using LLM
  • On the Evaluation of Large Language Models in Unit Test Generation 引用了 Efficient Memory Management for Large Language Model Serving with PagedAttention
它引用的引用它的从左到右按年份排列,引用越多,位置越高。

引用它的顶会 Paper被引最多的 5 篇,共 6 篇

  1. Reflective Unit Test Generation for Precise Type Error Detection with Large Language ModelsChen Yang, Ziqi Wang, Yanjie Jiang, Lin Yang 等ASE 2025 · 1 次引用
  2. CausalRepair: Bridging the Causality Gap in Large Language Model-Based Automated Program Repair via Dual-SlicingLinhao Wu, Yizhou Chen, Zhen Yang, Pengyu Xue 等ISSTA 2026
  3. What Makes In-Context Examples Effective for Code Generation?Dongze Li, Songqiang Chen, Jialun Cao, Shing-Chi CheungISSTA 2026
  4. Characterizing and Mitigating False-Positive Bug Reports in the Linux KernelJiashuo Tian, Dong Wang, Chen Yang, Haichi Wang 等FSE 2026
  5. Context Matters: Improving the Practical Reliability of LLM-Based Unit Test Generation (Experience Paper)Junjie Chen, Ziqi Wang, Lin Yang, Chen Yang 等ISSTA 2026

它引用的 Paper被引最多的 5 篇,共 10 篇

  1. Efficient Memory Management for Large Language Model Serving with PagedAttentionWoosuk Kwon, Zhuohan Li, Siyuan Zhuang, Ying Sheng 等SOSP 2023 · 1,016 次引用
  2. Code-Aware Prompting: A Study of Coverage-Guided Test Generation in Regression Setting using LLMGabriel Ryan, Siddhartha Jain, Mingyue Shang, Shiqi Wang 等FSE 2024 · 68 次引用
  3. On the Evaluation of Large Language Models in Unit Test GenerationLin Yang, Chen Yang, Shutao Gao, Weijing Wang 等ASE 2024 · 42 次引用
  4. DeepTC-Enhancer: Improving the Readability of Automatically Generated TestsDevjeet Roy, Ziyi Zhang, Maggie Ma, Venera Arnaoudova 等ASE 2020 · 32 次引用
  5. HITS: High-coverage LLM-based Unit Test Generation via Method SlicingZejun Wang, Kaibo Liu, Ge Li, Zhi JinASE 2024 · 29 次引用

相关 Paper

  1. Evaluating and Improving ChatGPT for Unit Test GenerationZhiqiang Yuan, Mingwei Liu, Shiji Ding, Kaixin Wang 等FSE 2024 · 89 次引用
  2. Beyond Coverage: Automatic Test Suite Augmentation for Enhanced Effectiveness using Large Language ModelsZeyu Lu, Peng Zhang, Yuge Nie, Yibiao Yang 等OOPSLA 2026 · 1 次引用
  3. PALM: Synergizing Program Analysis and LLMs to Enhance Rust Unit Test CoverageBei Chu, Yang Feng, Kui Liu, Hange Shi 等ASE 2025 · 3 次引用
  4. Test Intention Guided LLM-Based Unit Test GenerationZifan Nan, Zhaoqiang Guo, Kui Liu, Xin XiaICSE 2025 · 5 次引用
  5. Rug: Turbo Llm for Rust Unit Test GenerationXiang Cheng, Fan Sang, Yizhuo Zhai, Xiaokuan Zhang 等ICSE 2025 · 6 次引用
黄昏的海面,两侧是细线勾勒的悬崖