TestExplora: Benchmarking LLMs for Proactive Bug Discovery via Repository-Level Test Generation

Steven Liu, Jane Luo, Xin Zhang, Aofan Liu, Hao Liu, Jie Wu, Ziyang Huang, Yangyu Huang, Yu Kang, Scarlett Li

Large Language Models (LLMs) are rapidly transforming software development, but their evaluation in software assurance remains incomplete. Traditionally, software testing falls into three categories: regression prevention, reactive reproduction, and proactive discovery. While LLMs are frequently evaluated on the first two, current benchmarks systematically overlook the third.

TestExplora is a novel benchmark designed to evaluate LLMs as proactive testers in full-scale, realistic repository environments, challenging them to find latent defects before they manifest as production failures.

The Compliance Trap

Current evaluations often force models into what the authors call a "compliance trap." By treating existing code as the ground truth for regression testing, models learn to mimic current behavior—including any hidden bugs. Alternatively, benchmarks rely on post-failure artifacts, like issue reports, for reactive bug reproduction. At this stage, it is already too late; the bug has escaped into the wild.

The missing capability is proactive discovery: the ability of an AI to analyze a codebase, read the documentation, and identify discrepancies between the implementation and the documented intent.

Introducing TestExplora

To bridge this gap, researchers developed TestExplora, a comprehensive benchmark comprising 2,389 tasks across 482 diverse Python repositories. The framework introduces several key innovations to test autonomous bug discovery:

  • The Oracle Shift: Instead of using buggy code as a reference, TestExplora uses documentation-derived intent. To ensure high-quality references and bypass the problem of poor real-world documentation, a DocAgent generates precise docstrings from the "fixed" version of the code, creating a clear intent oracle.
  • Fail-to-Pass (F2P) Validation: A generated test is only deemed successful if it fails on the buggy version of the repository and passes on the fixed version. This strict criteria proves the LLM successfully isolated the specific defect.
  • Environment Automation: Utilizing GitHub Actions Runner images, the framework creates unified virtual machines to automatically handle complex dependencies across hundreds of repositories.
  • Continuous Data Collection: To mitigate data leakage—where models memorize older bug-fix datasets during training—TestExplora employs a time-aware collection framework that pulls recent pull requests.

Key Findings: The Capability Gap

The evaluation reveals a massive capability gap between writing code and autonomously finding bugs. Even the most advanced models struggle in this proactive setting.

State-of-the-Art Struggles: In standard benchmark settings, the best-performing model (Claude 3.5 Sonnet) achieved a maximum Fail-to-Pass (F2P) rate of only 16.06%. Over 80% of the time, models fail to proactively identify the defect.

The "More is Less" Paradox: Prompting a model to generate a larger volume of tests often decreases the overall success rate. As test volume increases, the probability of generating flaky tests or misconfigured mocks rises, diluting the suite's quality.

Context is a Double-Edged Sword: Researchers evaluated models in both "Black Box" (docs and signatures only) and "White Box" (full source code access) settings. Surprisingly, models like GPT-4o sometimes performed worse with full code access, struggling to filter out irrelevant details. This suggests that a long context window does not automatically equate to better reasoning.

Data Leakage Confirmed: Models performed significantly better on pre-2023 data compared to recent code. This validates the need for TestExplora's continuous data collection, confirming that many LLMs have memorized older datasets.

The Promise of Agentic Exploration

While static prompting struggles, agentic frameworks show a highly promising path forward. Models that can act as agents—using tools to explore the repository, run intermediate tests, and read files—perform significantly better than those relying on static prompts.

When instantiated with the SWEAgent framework, GPT-5-mini achieved an F2P of 17.27%, which jumped to 29.7% when allowed five attempts (F2P@5). This highlights that navigating complex cross-module interactions requires autonomous, agentic exploration.

Limitations and Future Directions

TestExplora currently relies on "clean" documentation generated from fixed code. In reality, documentation is often missing, outdated, or flawed. Future iterations of the benchmark will focus on intent recovery from messy documentation, reducing "test smells" (like assertion mismatches and misconfigured mocks), and expanding the benchmark beyond Python to languages like Java and C++.

Summary updated

BibTeX
@inproceedings{liu2026testexplora,
  author = {Steven Liu and Jane Luo and Xin Zhang and Aofan Liu and Hao Liu and Jie Wu and Ziyang Huang and Yangyu Huang and Yu Kang and Scarlett Li},
  title = {{TestExplora: Benchmarking LLMs for Proactive Bug Discovery via Repository-Level Test Generation}},
  booktitle = {International Conference on Machine Learning},
  year = {2026},
  url = {https://openreview.net/forum?id=pxw9YfTYtC},
}
Figure