SWT-Bench: Testing and Validating Real-World Bug-Fixes with Code Agents

Niels Mündler, Mark Niklas Müller, Jingxuan He, Martin Vechev
6/18/2024
cs.SEcs.AIcs.LG

Official code: logic-star-ai/swt-bench (85 stars, MIT, last commit 2026-04-28).

Abstract

Rigorous software testing is crucial for developing and maintaining high-quality code, making automated test generation a promising avenue for both improving software quality and boosting the effectiveness of code generation methods. However, while code generation with Large Language Models (LLMs) is an extraordinarily active research area, test generation remains relatively unexplored. We address this gap and investigate the capability of LLM-based Code Agents to formalize user issues into test cases. To this end, we propose a novel benchmark based on popular GitHub repositories, containing real-world issues, ground-truth bug-fixes, and golden tests. We find that LLMs generally perform surprisingly well at generating relevant test cases, with Code Agents designed for code repair exceeding the performance of systems designed specifically for test generation. Further, as test generation is a similar but more structured task than code generation, it allows for a more fine-grained analysis using issue reproduction rate and coverage changes, providing a dual metric for analyzing systems designed for code repair. Finally, we find that generated tests are an effective filter for proposed code fixes, doubling the precision of SWE-Agent. We release all data and code at https://github.com/logic-star-ai/SWT-Bench

View on arXivView PDF

Code Implementations(1)

MIT

[NeurIPS 2024] Evaluation harness for SWT-Bench, a benchmark for evaluating LLM repository-level test-generation

8519PythonJul 15, 20245 months agoMIT
benchmarkevaluation-frameworkllmunit-testing

Similar Papers

Cite this paper

@article{mndler2024swtbench,
  title  = {SWT-Bench: Testing and Validating Real-World Bug-Fixes with Code Agents},
  author = {Niels Mündler and Mark Niklas Müller and Jingxuan He and Martin Vechev},
  year   = {2024},
  eprint = {2406.12952},
  archivePrefix = {arXiv},
  doi    = {10.52202/079017-2601},
  url    = {http://arxiv.org/abs/2406.12952v3},
  journal = {NEURIPS 2024 2024}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2406.12952.svg)](https://codeofpaper.com/paper/2406.12952)

Discussion