Code evaluation · Research feature

LLM Generates Regression Tests for Code Changes in Structured Input Programs

A study evaluates large language models in generating regression tests for software changes in systems that process structured inputs like XML or PDFs.

Adapted from research by Jing Liu, Seongmin Lee, Eleonora Losiouk and colleagues.

arXiv preprint revision · 2026-07-02 · Attribution & reuse
In this article
Editorial illustration of aperture mechanism.

Editor’s introduction

The researchers tested LLM-based regression test generation on 72 commits across programs such as Mujs and Poppler, using commit messages, code changes, and input formats as inputs. The model effectively interpreted commit intent, such as changes to floating-point handling, and generated relevant test inputs. Adding more detail to vague commit messages improved test effectiveness, with average gains of 17 words significantly increasing bug discovery. However, in Poppler’s PDF parser, Cleverest failed to generate valid inputs for two specific issues, despite identifying relevant components. This suggests that while LLMs can capture semantic intent, they struggle with complex input format constraints, limiting their reliability in certain domains.

Introduction

Recently, Large Language Models (LLMs) have shown tremendous promise. Liu et al. published a comprehensive survey of research on the automation of software engineering processes, including requirements engineering, code generation, program analysis, testing, debugging, and end-to-end development and maintenance.

In this paper, we explore the utility of LLMs as test generators for code commits or pull requests in the continuous integration/continuous development (CI/CD) pipeline. When a new bug fix or a code change is committed and the project is built and analyzed as part of CI/CD pipeline, running an LLM for a few minutes to generate regression test cases for that commit could help exercise the changed code and potentially trigger any bugs. Specifically, discovering bugs i) introduced or ii) insufficiently fixed by a commit are the two primary objectives of our paper. We investigate LLM-based regression test generation as a machine translation task that takes the developer-provided commit message, the code change, and the name of a well-known input format (e.g., XML or JS) and produces regression test cases for the commit in the given input format. In systems without precise test oracles (e.g., interpreters, parsers, compilers), such regressions are typically identified via crashes, sanitizer violations, or observable output differences, like in (differential) fuzzing.

In our experiments, we tested 72 commits to eight programs (Mujs, Libxml2, Poppler, JerryScript, Z3, PHP, JQ, and MicroPython), which take highly structured, human-readable input formats. Our feedback-directed, zero-shot LLM-based prototype Cleverest performed well. In under two minutes, on average, Cleverest found as many bugs as the state-of-the-art directed greybox fuzzer WAFLGo found in 24 hours, even though WAFLGo already starts with a commit-reaching seed corpus for the majority of commits. We find that our tool’s effectiveness varies across input formats and LLMs. For instance, Cleverest performs much better for human-readable formats like XML and JavaScript than for binary formats like PDF. Effectiveness also scales with LLM size: a weaker GPT-4o mini reduces effectiveness, while a stronger DeepSeek-R1 found a bug missed by GPT-4o.

Most interestingly, we identify a critical dependence of Cleverest’s effectiveness on the commit message. In fact, Cleverest continues to generate effective test cases even when only the commit message is provided, as long as the intention of the change is captured. For instance, if the commit message describes the handling of floating point variables, then Cleverest generates Javascript programs that contain floating point variables. In contrast, the non-descriptive commit messages in Z3 (e.g., fix #[Issue ID]) are unlikely to yield effective regression tests while the expressive commit messages are more likely to reveal bugs. To study the impact of expressiveness, we change the commit messages minimally to reduce and increase the information, respectively, and indeed confirm a substantial impact on effectiveness. For instance, adding 17 words on average (max. 43) to make ineffective messages more expressive significantly increased the number of bugs found.

Experimental Design

In this paper, we seek to evaluate the capabilities of a large language model (LLM) as a regression test generation tool in the CI/CD pipeline for programs that take highly structured, human-readable inputs, like JavaScript programs or XML files. While classical regression testing focuses on passing test cases across program versions, our setting lacks a specification or pre-existing tests. Thus, our primary objective is to determine how well an LLM performs in generating test cases that: reach the changed code, observe behavioral differences, and trigger bugs detectable via sanitizers. These metrics reflect standard practice in regression fuzzing, where a regression manifests as a newly introduced crash. We implement a feedback-directed LLM-based regression test generator involving a prompt synthesizer and execution analyzer. We call our tool Cleverest.

RQ1. Evaluation of Capabilities

However, for Poppler PDF parser, which requires a complex input format, Cleverest could only reproduce one bug. At least, it reached the changed code in half of the commits and exposed a difference in one commit. Cleverest consistently fails to generate an effective input in both scenarios for issues #1305 and #1381 of Poppler. While the generated input contains some related components required to test the commit, it does not satisfy the validity constraints required to successfully parse the input. For instance, Cleverest can generate an input that already contains the key elements necessary for revealing the bug in Issue #1305, including an annotation of type Highlight with an appearance stream and a Resources dictionary with an ExtGState entry. The failure to reach the commit occurs because Poppler strictly checks the existence of QuadPoints and Rect properties in the annotation object and exits early before reaching the changed code. If Cleverest knew these validity constraints and added these specific elements, as we confirmed, the generated PDF input could have reached the commit and even demonstrated an output difference.

Cleverest also struggles to generate bug-reproducing inputs for Z3 due to extremely simple commit messages that provide no information about the bug or fix. All four commits use the generic message ‘‘fix #[Issue ID],’’ with no further details. These are clear outliers (word count: 2) compared to the average commit message length in other programs (word count: 38).33 3 Full commit message length statistics are available in Supplementary Material. This is another piece of evidence for our observation that the LLM can translate the intention of a well-described code change into a regression test case. We investigate this phenomenon further in RQ3.

RQ2. Ablation Study

Commit Information. We evaluate the impact of only using the commit message but not the diff (Only msg) or only using the commit diff but not the message (Only diff) and find that the results reproduce as long as the intention of the change is captured. In the bug-finding scenario, providing only the commit message or diff only changes the score slightly from 1.37 (meaning ‘sometimes output-changing’) to 1.41 and 1.36, respectively. However, in the bug-reproduction scenario, we observe cases where a single source is insufficient: some commit messages lack detail while others are too high-level compared to the diff. Specifically, some messages are too brief (e.g., “Fix #IssueId”) and provide less information than the code changes (e.g., Issue #141 in Mujs, where the diff details specific escape sequences absent from its message). In contrast, other messages provide critical high-level intent (e.g., MicroPython Issue #13087 “Fix int.to_bytes buffer size check”) that goes beyond the literal syntax changes in the diff, from which the intent can be too difficult to infer. This discrepancy between the commit message and code diff makes having both sources of information meaningful, and removing the diff (Only msg) or the message (Only diff) causes a performance drop from 1.27 to 1.08 and 1.05 (meaning ‘at least reaching’), respectively. We seek deeper case studies on the informativeness of commit messages and its impact on test generation in RQ3.

Task Difficulty. We evaluate the impact of having Cleverest generate the command-line prompt in addition to the regression test case (Gen. cmd) for Libxml2, Poppler, and JQ, which require a specific command-line prompt to find or reproduce the bug. Our results show a noticeable but limited negative effect on Cleverest’s performance for 7 out of 28 (25%) commits, changing the overall average score from 1.37 to 1.19 and 1.27 to 1.08 for the bug-finding and bug-reproduction scenarios, respectively. This is primarily because some programs have vast input space for command line prompts, while the bugs can only be triggered by specific values. For example, JQ #3262 was triggered by command jq.[54E100]=7 in the original PoC. Cleverest could reliably generate commands with the array index feature to reach code changes, but only reproduced the bug in 2 out of 10 repetitions. This suggests that the LLM is capable of generating relevant command-line prompts for regression testing, though it struggles when the input space is vast.

Interestingly, Cleverest found one otherwise undiscovered bug when asked to also generate the command line prompt for reproducing Issue #550 of Libxml2 2. This bug was unrelated to Issue #550 but the bug-triggering command line —xpath —dropdtd was related to the same feature that was changed. This confirms our intuition that Cleverest generates regression test cases from the intention more than the actual code changes.

LLM Module. We evaluate the impact of LLM size on Cleverest’s performance and find that model power significantly affects effectiveness. Using a weaker LLM (GPT-4o mini) reduces effectiveness for 16 issues in the bug-finding scenario, with test cases failing to reach code changes in 5 BICs. The average score drops from 1.37 to 0.97. For the bug reproduction scenario, effectiveness was reduced for 12 patches. In 4 cases, test cases fail to reach code changes, and the average score drops from 1.27 to 1.01. Conversely, a stronger LLM (DeepSeek-R1) enables Cleverest to find more bugs. In the bug-finding scenario, the number of bugs increased from 7 to 10, with 1 fewer in JerryScript, but 4 additional bugs in JQ, Poppler, PHP, MicroPython, respectively, while GPT-4o failed to find any for the last three subjects. In the bug-reproduction scenario, the number of detected bugs increases from 13 to 20, with 1 fewer in Mujs, but 2 additional bugs in JerryScript, 2 in JQ, and 4 in MicroPython. The average score rises from 1.37 to 1.62 in the bug-finding scenario and from 1.27 to 1.62 in the bug-reproduction scenario. These results indicate that effectiveness heavily depends on the LLM’s size/capacity, particularly for generating complex inputs.

RQ4.1 Comparison with WAFLGo

Effectiveness. In the bug reproduction scenario, Cleverest (without initial seeds) outperforms WAFLGo (which requires seeds): it reproduces bugs in 11 of 24 BFCs, compared to WAFLGo’s 8 of 24. This is a notable improvement, especially given that Cleverest operates without a seed corpus. In the bug finding scenario, Cleverest reaches the modified code in 22 of 26 BICs and changes the output in 17 of them, both higher than WAFLGo. However, it triggers the actual bug in 7 of 26 BICs, fewer than WAFLGo (10 of 26). This result is expected, since Cleverest relies on the intention expressed in commit messages (as shown in RQ3), and BICs often describe new features or improvements rather than the bug itself. We further examine WAFLGo’s dependence on the initial seed corpus in the next section.

Execution time. Cleverest is substantially faster than WAFLGo, making our LLM-based approach more suitable as part of the CI/CD pipeline, which runs under strict time and resource constraints. A typical fuzzing campaign is set to 24 hours. Apart from ten cases where the initial seeds already exposed the bug introduced or patched by a commit, WAFLGo takes between five minutes and five hours on average to find the bugs, and otherwise times out. For the commit fixing Issue #2976 of JQ, WAFLGo took more than 19 hours. Cleverest’s execution time is bounded by the number of feedback iterations (fixed to 5 in our experiments) and requires roughly a minute for Mujs, Libxml2, JerryScript, JQ, and MicroPython and mostly less than three minutes for Poppler, Z3, and PHP.

Fuzzing Cleverest’s seeds for improved effectiveness. Since fuzzing works well if seeds are close already, why not try using the Cleverest-generated inputs as fuzzer seeds (ClevFuzz)? During qualitative analysis of change-reaching and output-changing Cleverest test cases for RQ1 (§3.1), we found that they are often not ‘‘very far’’ from bug-revealing; a few modification can turn them to bug-finding test cases. This idea is further inspired by LLMs being used as seed generators for fuzzing, a successful strategy in the 2024 DARPA AI Cyberchallenge (AIxCC).44 4 Trail of Bits, one of the finalists says: “Our system uses large language models (LLMs) to generate seed inputs for fuzzing, significantly reducing the time needed to discover vulnerabilities. This innovative approach helps us work within the competition’s strict time constraints.”

Specifically, ClevFuzz can find 13 additional bugs for BICs and 7 for BFCs after the fuzzing campaign. The fuzzing turned 96 out of 143 (67%) Cleverest-generated test cases for BICs and 54 out of 83 (65%) for BFCs into bug-revealing test cases. This indicates that Cleverest-generated test cases are often close to bug-revealing already, and fuzzing can effectively explore the neighborhood of these test cases to find the bugs.

More recent advancements have explored the adoption of LLMs for automatic unit test generation. TESTPILOT relies on LLMs to generate unit tests by providing the signature, implementation and usage documentation of the function under test, and iteratively refine the tests with execution feedback. ChatUnitTest overcomes the prompt context window limit by adaptively selecting the most relevant code elements, and mitigates errors in tests through a generation-validation-repair loop. SymPrompt generates test inputs for executing a specific path identified during the static analysis. HITS tackles the problem of testing complex methods by using LLMs to decompose method-to-test and generate unit tests slice by slice. COVERUP achieves high coverage by including coverage information in feedback to generate unit tests targeting uncovered code. These works share the same goal of generating better unit tests to improve overall coverage, while Cleverest aims to generate system-level directed input to test specific regression changes. More generally, we are interested in regression test generation as a machine translation task from the intention of a change to a test of that change.

LIBRO relies on LLMs to generate and rank candidate test cases from bug reports in structured benchmarks like Defects4J. Testora uses LLMs to identify behavioral changes in regression tests generated for API calls from four Python libraries. Meta also internally deploys LLM-based test generation system to find software regression using mutation testing. This system assumes the presence of mutants and leverages them to strengthen regression test suites, while Cleverest investigates whether LLMs can independently produce such precise tests in the first place.

Recent works have also highlighted the role of intention in other software engineering tasks. Guo et al. propose a framework for code refinement, where review comments are translated into structured intentions and then used to guide LLMs in generating code modifications. Similarly, Qi et al. formalizes validation intentions (e.g., objectives, preconditions, and expected results) to generate unit tests. Such approaches focus on extracting and encoding intentions to drive refinement or generation. In contrast, Cleverest does not formalize intention, but rather studies how intention expressed in commit messages affects the quality of generated test inputs.

LLMs for Fuzzing. Several fuzzers leverage LLMs to enhance fuzzing techniques, but each operates with different goals and methods. ChatAFL uses LLMs to construct grammars for protocol messages, mutate inputs, and generate sequences to improve fuzzing efficiency, distinguishing it from Cleverest, which is not a protocol fuzzer. PromptFuzz, meanwhile, utilizes LLMs to iteratively generate fuzz drivers that explore API functions, making it fundamentally different from Cleverest, which focuses on fuzzing through input generation rather than fuzz driver creation. Fuzz4All employs a pure-LLM approach to generate and mutate code snippets testing various compiler features with user-provided documentation and example code. Jiang et al. conducted the first systematic study comparing LLMs with constraint-based techniques for directed test input generation, evaluating their ability to reach specific target branches. Cottontail uses LLMs to extends concolic execution for systematically testing programs taking highly-structured inputs. TELPA combines program analysis with LLMs to cover hard-to-cover branches by extracting real usage scenarios and resolving inter-procedural dependencies. Cited researchers introduce evaluate the utility to test a software system end-to-end to bridge the reachability gap. In contrast, Cleverest generates a few regression tests directed towards a given commit in a zero-shot manner.

Discussion

Throughout the study, we have shown the significant potential of LLMs in generating structured, human-readable, system-level inputs for testing code changes. Our results highlight that even without advanced techniques such as fine-tuning or retrieval-augmented generation (RAG), LLMs, when combined with prompting and execution feedback, are capable of producing high-quality test inputs. These inputs can reflect the semantic meaning inside commits. In some cases, they directly trigger the bugs, and in other cases, they could be “repaired” to trigger the bugs. So there is potential for LLMs in directed software testing, enabling automated testing workflows that are typically more challenging for conventional tools.

One notable observation is the LLM’s ability to generate meaningful input without access to source code context, as long as we describe the intention with accurate natural language. For the philosophical minded, this finding resonates with Wittgenstein’s statement in his Tractatus: “What can be shown cannot be said”. Here what is said is the commit message describing the developer’s intention and what is shown is the concrete executable test demonstrating the consequence of that intention. Our results show that the inverse might be true for automated software engineering: much of what can be “said” can indeed be “shown”. Our work unlocks the potential of “vibe testing” as a new form of “language game”, where users describe high-level intention with natural language, and LLM-powered systems instantiate the meaning into concrete tests to trigger specific behavior of the underlying program, with this “vibe” becoming a tangible, testable reality.

While using our tool Cleverest standalone has already shown promising results in generating effective test cases in a short time, we believe the value of Cleverest shines even more in their subsequent use as a tool in a developer’s hand. The LLM-generated test cases are easily comprehensible by human developers, as they are structured and human-readable; we demonstrated how human developers can modify these test cases to trigger bugs. They are also an excellent seed generator for regression greybox fuzzers; even a vanilla greybox fuzzer can perform similarly or better than WAFLGo, which requires a user-provided seed corpus.