IntelliUnitGen: A Unit Test Case Generation Framework Based on the Integration of Static Analysis and Prompt Learning

1Citations
Citations of this article
28Readers
Mendeley users who have this article in their library.

This article is free to access.

Abstract

Test case generation is a critical research topic in the field of automated software engineering. In recent years, with the rapid advancement of large language models (LLMs) such as the GPT series, LLaMA series, and DeepSeek series, both domestic and international researchers have attempted to leverage prompt learning capabilities of LLMs for automated test case generation and have achieved promising results. However, most existing approaches rely solely on the language model’s ability to respond to natural language prompts, while neglecting systematic analysis of static features within source code. These methods often fail to apply traditional static analysis techniques to extract structural and semantic information from the source code, resulting in incomplete generation, omission of key elements, or semantic misinterpretation. To address these limitations, this paper proposes IntelliUnitGen — an intelligent unit test case generation framework that integrates static analysis with prompt learning. This framework aims to combine the advantages of traditional static analysis techniques with the cutting-edge capabilities of LLMs to enhance the automation level and quality of unit test case generation. IntelliUnitGen synthesizes static code features extracted via static analysis into structured, task-relevant prompts for the language model. It adopts a chain-of-thought prompting strategy to guide the LLM in generating rigorous and comprehensive test cases. The overall workflow of the proposed framework is presented, followed by a detailed introduction to its key techniques and implementation details. An illustrative example is provided to intuitively demonstrate the test case generation process of the framework, and experimental validation is conducted on three open-source projects. Experimental results show that IntelliUnitGen significantly outperforms traditional (non-LLM-based) tools and LLM-only prompt learning approaches in metrics such as coverage, generalizability, and compilability & executability, achieving state-of-the-art (SOTA) performance. This study demonstrates the potential of integrating static code analysis with prompt learning to improve not only unit test case generation but also other source code processing tasks, potentially overcoming existing limitations of LLMs in software engineering applications. This framework demonstrates a practical step forward in addressing long-standing challenges in automated software testing. To facilitate reproducibility and further research, the complete implementation of the IntelliUnitGen framework, alongside the generated test cases and JaCoCo coverage reports for all experimental projects, has been made publicly available at: https://github.com/yangzy0115/IntelliUnitGen

Cite

CITATION STYLE

APA

Yang, Z., & Wang, L. (2025). IntelliUnitGen: A Unit Test Case Generation Framework Based on the Integration of Static Analysis and Prompt Learning. IEEE Access, 13, 177760–177784. https://doi.org/10.1109/ACCESS.2025.3615990

Register to see more suggestions

Mendeley helps you to discover research relevant for your work.

Already have an account?

Save time finding and organizing research with Mendeley

Sign up for free