A Cascaded Pipeline for Self-Directed, Model-Agnostic Unit Test Generation via LLMs

While existing ML-based unit test generation methods show promising results, they face three key limitations: (1) incomplete test case generation with excessive focus on test oracles, (2) semantic inconsistencies between test components, and (3) dependency on closed-source models compromising data s...

Ausführliche Beschreibung

Gespeichert in:
Bibliographische Detailangaben
Veröffentlicht in:Proceedings - International Symposium on Software Reliability Engineering S. 276 - 287
Hauptverfasser: Ni, Chao, Wang, Xiaoya, Yin, Xin, Chen, Liushan, Ma, Guojun
Format: Tagungsbericht
Sprache:Englisch
Veröffentlicht: IEEE 21.10.2025
Schlagworte:
ISSN:2332-6549
Online-Zugang:Volltext
Tags: Tag hinzufügen
Keine Tags, Fügen Sie den ersten Tag hinzu!
Beschreibung
Zusammenfassung:While existing ML-based unit test generation methods show promising results, they face three key limitations: (1) incomplete test case generation with excessive focus on test oracles, (2) semantic inconsistencies between test components, and (3) dependency on closed-source models compromising data security. In this paper, we propose a novel approach named CasModaTest, a cascaded, model-agnostic, and end-to-end unit test generation framework, to alleviate the above limitations. Specifically, CasModaTest first splits the unit test generation task as two cascaded steps: test prefix generation and test oracle generation. Then, to better stimulate models' learning ability, we manually build large-scale demo pools to provide CasModaTest with high-quality test prefixes and test oracles examples. Finally, CasModaTest assembles test components and validates their functionality through execution, with error correction during compilation/runtime. Our evaluation on the Defects4J benchmark demonstrates CasModaTest's superiority over five state-of-the-art approaches, showing significant improvements in both accuracy and focal method coverage. Further validation across \mathbf{1, 6 2 5} methods from six real-world projects reveals that CasModaTest achieves substantially higher code coverage metrics (method/line/branch coverage) compared to the dedicated coverage tool EvoSuite.
ISSN:2332-6549
DOI:10.1109/ISSRE66568.2025.00037