SlicePromptTest4J: High-coverage Test Generation using LLM via Method Slicing
Large language models (LLMs) have behaved well in generating unit tests for Java projects. However, the performance for covering the complex focal methods within the projects is poor. Complex methods comprise many conditions and loops, requiring the test cases to be various enough to cover all lines and branches. However, existing test generation methods with LLMs provide the whole method-to-test to the LLM without assistance on input analysis. The LLM has difficulty inferring the test inputs to cover all conditions, resulting in missing lines and branches. To tackle the problem, we propose decomposing the focal methods into slices and asking the LLM to generate test cases slice by slice. Our method simplifies the analysis scope, making it easier for the LLM to cover more lines and branches in each slice. We build a dataset comprising complex focal methods collected from the projects used by existing state-of-the-art approaches. Our experiment results show that our method significantly outperforms current test case generation methods with LLMs and the typical SBST method Evosuite regarding both line and branch coverage scores.
Thu 31 OctDisplayed time zone: Pacific Time (US & Canada) change
10:30 - 12:00 | Test generationResearch Papers / Journal-first Papers at Gardenia Chair(s): Lingming Zhang University of Illinois at Urbana-Champaign | ||
10:30 15mTalk | Towards Understanding the Effectiveness of Large Language Models on Directed Test Input Generation Research Papers Zongze Jiang Huazhong University of Science and Technology, Ming Wen Huazhong University of Science and Technology, Jialun Cao Hong Kong University of Science and Technology, Xuanhua Shi Huazhong University of Science and Technology, Hai Jin Huazhong University of Science and Technology | ||
10:45 15mTalk | Distribution-aware Fairness Test Generation Journal-first Papers Sai Sathiesh Rajan Singapore University of Technology and Design, Singapore, Ezekiel Soremekun Royal Holloway, University of London, Yves Le Traon University of Luxembourg, Luxembourg, Sudipta Chattopadhyay Singapore University of Technology and Design | ||
11:00 15mTalk | Effective Unit Test Generation for Java Null Pointer Exceptions Research Papers Myungho Lee Korea University, Jiseong Bak Korea University, Seokhyeon Moon , Yoon-Chan Jhi Technology Research, Samsung SDS, Seoul, South Korea, Hakjoo Oh Korea University | ||
11:15 15mTalk | SlicePromptTest4J: High-coverage Test Generation using LLM via Method Slicing Research Papers Zejun Wang Peking University, Kaibo Liu Peking University, Ge Li Peking University, Zhi Jin Peking University | ||
11:30 15mTalk | DeepREST: Automated Test Case Generation for REST APIs Exploiting Deep Reinforcement Learning Research Papers Davide Corradini University of Verona, Zeno Montolli University of Verona, Michele Pasqua University of Verona, Mariano Ceccato University of Verona | ||
11:45 15mTalk | On the Evaluation of Large Language Models in Unit Test Generation Research Papers Lin Yang Tianjin University, Chen Yang Tianjin University, Shutao Gao Tianjin University, Weijing Wang College of Intelligence and Computing, Tianjin University, Bo Wang Beijing Jiaotong University, Qihao Zhu DeepSeek-AI, Xiao Chu Huawei Cloud Computing Co. Ltd., Jianyi Zhou Huawei Cloud Computing Technologies Co., Ltd., Guangtai Liang Huawei Cloud Computing Technologies, Qianxiang Wang Huawei Technologies Co., Ltd, Junjie Chen Tianjin University Pre-print |