kS-LLM: k-Step based Automatic LLM Test Case Generator using Caching Mechanism to Achieve Higher Code Coverage

Publications

kS-LLM: k-Step based Automatic LLM Test Case Generator using Caching Mechanism to Achieve Higher Code Coverage

Author : Dr Vivek Yelleti

Year : 2026

Publisher : Association for Computing Machinery, Inc

Source Title : Proceedings of the 19th Innovations in Software Engineering Conference, ISEC 2026

Document Type :

Abstract

As software systems grow increasingly complex, they become more prone to instability. Performing rigorous testing before deploying these software systems in the production environment is necessary and important. Existing test case generation techniques rely on randomness or manual effort, leading to low code coverage and uncovered edge cases. To address this issue, we propose the k-step Large Language Model (kS-LLM), which takes a program and generates test cases via a k-step refinement process. Furthermore, we employed a caching mechanism to avoid the generation of duplicate test cases. GCOV-based is incorporated to obtain line and branch coverage analysis. kS-LLM is equipped with feedback, in which test cases generated in previous iterations are used as input for subsequent iterations. The process continues until either a predefined coverage threshold is reached or the maximum number of iterations is exceeded. We validated the proposed on 160 C-programs. Experimental results demonstrate that kS-LLM is more effective than traditional test generation techniques achieving 9.86% higher line coverage and 10.74% higher branch coverage than C Bound Model Checker (CBMC) while reducing manual effort.