Skip to content
Open access

Improving Bug Detection in LLM-Generated Unit Tests: Revisiting Test-Oracle Reliability Across Modern Large Language Models

Aug 2026 · Al-Noor Journal of Engineering Management and Computer Science · 0 citations · 9 references

TL;DR

This paper presents a formal mathematical model for categorizing the outcome of generated-tests into four classes, a couple of basic metrics: Bug-Revealing Rate (BRR) and Bug-Validating Rate (BVR); and two basic statistical tests to ensure that the results are rigorous.

Abstract

The widespread adoption of Large Language Models (LLMs) has given rise to a new generation of automated unit-test generation tools, such as Codium CoverAgent, CoverUp, and GitHub Copilot, promising to reduce the manual burden of writing tests while preserving bug-detection quality. However, a recent study revealed a fundamental issue: these tools may generate tests that are effectively "designed to pass" rather than designed to catch bugs, because the test oracle is frequently derived from the very code under test rather than from an independent specification of correct behavior. This paper presents a Replication and Extension Study that re-examines this issue using a newer generation of large language models (e.g., Claude Sonnet 4.6, GPT-5, and open-source models such as Qwen3-Coder), using the Refactory dataset, which contains 1,783 real buggy Python programs written by actual university students alongside 2,442 correct reference solutions. This paper presents a formal mathematical model for categorizing the outcome of generated-tests into four classes, a couple of basic metrics: Bug-Revealing Rate (BRR) and Bug-Validating Rate (BVR); and two basic statistical tests: McNemar test and Wilson confidence interval to ensure that the results are rigorous. The paper sets out to address a direct research question: has the effectiveness of bug detection increased with the capabilities of LLMs, or does it stem from a structural problem that is not dependent on the underlying model? The Bug-Revealing Rate increases from 22.9% (GPT-4) to 39.1% (Qwen3-Coder) for all four models, reflecting an improvement in model ability to reveal bugs; however, the ability of the strongest model (Qwen3-Coder) to validate bugs decreases from 41.1% to 26.2%, suggesting that the test-oracle design problem is significantly reduced but not eliminated by model strength.

Read PDF

Similar papers

Jul 2026

Do Coverage and Mutation Scores of LLM-Generated Test Suites Correlate with Their Effectiveness? (Replicability Study)

It is found that the usefulness of coverage and mutation is highly context-dependent: in regression-style settings where the code provided to the LLM can be reasonably assumed bug-free, these metrics can provide meaningful signals when comparing across models; in another common scenario where the code-under-test may al...

Junda Zhao, Shurui Zhou, Eldan Cohen · 0 citations

Evaluating and Mitigating the Misguidance Effect of Buggy Code in LLM-Generated Unit Tests

A specification-based unit test generation paradigm that replaces the code under test in the prompt with an LLM-generated specification docstring is introduced, showing that this paradigm effectively reduces misguided tests while substantially increasing effective tests, improves multi-round, feedback-driven test gener...

Junda Zhao, Shurui Zhou, Eldan Cohen · 1 citation
Jul 2026

LLM-Based Invariant Testing for Software Functional Bugs

LISA iteratively generates API sequences and program invariants guided by API n-gram feedback, achieving higher bug-detection rates and competitive code coverage compared with both fuzzing and prior LLM-based test generation approaches, and reporting each finding as a high-confidence bug candidate for developer confirm...

Ruogu Yang, Yifeng He, Yundi Xu et al. · 0 citations
Jul 2026

Beyond Fail-to-Pass: Iterative Hardening of Co-Generated Bug Reproduction Tests and Fixes

CoHarden is proposed, a co-generation framework that uses the Lax signal as an in-loop convergence criterion that generates a test before any fix, then iteratively hardens the test and fix against surviving mutation patches until the generated test no longer admits Lax regressions.

Yuhao Tan, Zhibang Yang, Fangkai Yang et al. · 1 citation
Preprint Aug 2026

Unreliable in Practice? A Comprehensive Study of Errors in LLM-Generated Code

It is observed that generated code often omits basic input validation or memory-safety checks, which can lead to overflows, resource exhaustion, or other reliability/security issues, and even the largest models frequently make simple mistakes.

Rodrigo Pato Nogueira, Marco Vieira, João R. Campos · 0 citations

We use cookies to run the site and, with your consent, for analytics and to show ads. See our Cookie Policy.