Manuscript Offprint

arXiv:2609.09315

How effective are traditional test criteria at detecting bugs in large language models generated code?

Asma Hamidi, Michael Konstantinou, Renzo Degiovanni, Mike Papadakis

Asma Hamidi

SnT, University of Luxembourg

Luxembourg

asma.hamidi@uni.lu

Michael Konstantinou

SnT, University of Luxembourg

Luxembourg

michael.konstantinou@uni.lu

Renzo Degiovanni

Luxembourg Institute of Science

and Technology

Luxembourg

renzo.degiovanni@list.lu

Mike Papadakis

SnT, University of Luxembourg

Luxembourg

michail.papadakis@uni.lu

Abstract—Test adequacy criteria are widely used to evaluate and guide software testing. Although prior research has extensively examined these criteria using human-written programs, faults, and tests, the increasing adoption of Large Language Models (LLMs) for code generation raises important questions about their effectiveness in detecting LLM-induced faults. To investigate this, we conduct an empirical study involving 5 LLMs and 4 benchmarks, simulating end-to-end workflows in which both code and tests are automatically generated. We collect 6,000+ faulty program instances and evaluate the effectiveness and efficiency of 3 widely used adequacy criteria: statement coverage, branch coverage, and mutation testing. Our findings reveal several key insights. First, most faults introduced by LLMs are relatively trivial to catch. Second, the challenging faults are difficult to trigger using either traditional coverage-based or mutation-based criteria. Third, actual fault detection rates remain extremely low, often near zero, because test oracles fail to capture faulty behavior triggered by the generated test prefixes, exposing a critical limitation of automated test generation. Fourth, prompt-aware oracles can improve fault detection, but their overall effectiveness remains limited, highlighting the need for users to manually reason about test assertions. We further observe that mutation testing only marginally outperforms traditional coverage criteria in both triggering and detecting faults, raising questions about whether its significantly higher application cost is justified in this context.

Index Terms—Software Testing, Test adequacy criteria, LLM generated code, test automation.

I. INTRODUCTION

The question of the sufficiency and effectiveness of coverage criteria in steering software testing toward fault detection in automatically generated code remains unresolved. Prior research has examined the relationship between various structural coverage measures and fault detection using programs and defects produced by human developers [1], [2]. Determining whether traditional test coverage adequacy criteria remain suitable for automatically generated code is increasingly important, particularly with the growing adoption of “vibe coding”.

Traditional test adequacy criteria are designed to capture mistakes typically made by human developers [3]. They implicitly assume that faults arise around conditional boundaries, that code complexity is manageable and easily understandable by human readers, that code is coherent with limited redundancy, and that there is a clear separation of concerns within the program logic. However, these assumptions may not hold for automatically generated code. Even if they do, it remains unclear whether such code exhibits the same fault patterns as human-written programs. For example, errors in LLM-generated code often stem from under-specified prompts [4], ambiguities and contradictions in natural language descriptions [5], or the model's inability to correctly align code with its intended semantics [6].

The test effectiveness of traditional adequacy criteria remains under-explored and insufficiently characterized in this scenario. Should these criteria prove to be of limited significance, this would motivate new research directions aimed at developing specialized testing metrics tailored to LLM-based or agent-based systems. Moreover, such findings would raise concerns related to the scientific validity of prior studies that rely on these criteria to assess the effectiveness of test generation or oracle construction techniques. Our empirical analysis provides strong evidence that traditional test criteria fail to trigger and detect almost all faults examined (approximately miss approximately 99% of them), suggesting that they are of limited power.

We start our study by building the pool of LLMs-generated faults to investigate. To do so, we employ four established coding benchmarks (namely HumanEval+ [7], [8], MBPP [9], BigCodeBench [10] and NaturalCodeBench [11]), for which we augment the provided test suites with LLM-generated tests. These augmented test suites are generated with the intention achieve near-adequacy with respect to standard criteria, whose coverage and mutation scores achieved ensure a high-quality pool of test data. We then run the code generation process using different LLMs (namely, GPT-5-Mini, GPT-4.1-Mini, Claude-Haiku 4.5, Deepseek-v4-flash, and Llama 3.3-70B-Instruct) accordingly. We then use the augmented test pool to identify faulty cases by comparing the behavior of the gen-erated programs against that of a reference (assumed correct) implementation. This controlled setup ensures that any fault triggered by the tests can be reliably detected, while avoiding dependence on the specific test oracles (i.e., assertions). Overall, we collect a total of 73,785 valid faulty LLMs-generated implementations, from which we remove 43,272 faults that are relatively trivial to detect (i.e., they can be revealed by almost any test) and can bias our evaluation. Hence, we end up with a substantial subset of 30,513 challenging faults. However, to avoid having an imbalanced number of faults for different tasks, we only consider the most difficult fault per task, resulting in a final set of 6,066 more challenging faults that can potentially escape standard testing processes.

To study whether traditional test adequacy criteria remain suitable for automatically generated code, we perform the following controlled experiment. For each test adequacy criterion under study (statement/branch/mutation), we randomly sample 100 (minimal) test suites from the generated test pool that maximize the coverage metric of interest (i.e. we interactively pick a random test that increases the coverage, until same coverage as the generated test pool is reached). We then evaluate the sampled test suites in terms of both fault triggering and fault detection capabilities. We distinguish between these two notions: fault triggering assesses whether a test input exercises a faulty execution path, whereas fault detection evaluates whether the associated test oracle successfully identifies the resulting erroneous behavior. This distinction is critical, as incorrect or insufficient test oracles may fail to detect faults even when they are triggered.

Perhaps the most notable finding of our study is the relatively low fault-triggering capability of the considered criteria, as well as the marginal differences between them. On average, the fault triggering rate for statement coverage, branch coverage, and mutation testing is 32.9%, 38.9%, and 32.2%, respectively, while their respective fault detection rate is approximately 1-2%. To further strengthen fault detection, we designed a prompt-aware oracle generation approach, following the suggestions made by prior work [12], by asking LLMs to augment tests and oracles based on the given task descriptions/prompts. While this approach shows some potential, the overall effectiveness remains limited (we observe a fault detection improvement of around 6.6% on average). These findings highlight the continued need for human oversight, particularly in the construction and validation of test assertions.

Another interesting (and perhaps surprising) findings of our study is that while there is a lot of evidence that traditional fault injection techniques can produce artificial faults that couple with real (human-written) faults [13], results suggest that these do not couple with faults generated by the LLMs. In a sense, LLMs make a different kind of mistakes than humans, which may require adapting and rethinking the software testing methodologies to test LLM-based and agent-based code generators.

Further research is required to deepen our understanding of this fundamental aspect of software testing, and we do not claim to have fully resolved all related questions in this work. Nevertheless, we believe that our findings substantially advance the understanding of coverage criteria in the context of “vibe coding” and automatically generated programs. Our primary contributions are twofold: first, we highlight a critical challenge in transitioning from traditional testing practices to settings involving machine-generated code; second, we expose the limitations of conventional adequacy criteria and outline promising directions for future research. Most importantly, our study provides empirical evidence of a lack of effective guidance toward strong fault detection in code generated by large language models.

References (51)