GEM: A Framework for Strengthening LLM-Generated Unit Tests Using Mutation Feedback
Abstract
Large Language Models (LLMs) are increasingly used for automated unit test generation and can produce executable tests with substantial structural coverage. However, recent empirical studies indicate that such tests often rely on weak or superficial assertions, leading to limited fault-detection capability despite extensive code coverage. This paper introduces GEM (Generate-Execute-Mutate), an automated framework that systematically strengthens test oracles to improve the mutation-based adequacy of LLM-generated unit tests. GEM integrates three stages into a unified pipeline: LLM-based test synthesis, execution-driven self-repair of failing tests, and mutation-guided oracle refinement. The framework follows a modular hexagonal architecture and supports multiple programming languages through pluggable adapters for test execution, coverage analysis, and mutation testing. GEM was evaluated on three established benchmarks across Python, Java, and C++, using multiple state-of-the-art LLMs, and was compared with the automated testing tool Pynguin. Experimental results reveal a persistent gap between coverage and mutation score in baseline LLM-generated tests. Under the evaluated setup, mutation-guided strengthening improved mutation scores on Python and yielded smaller gains on Java, while execution-driven self-repair improved executability across several model and dataset settings.
Fields of Study & Subjects
Software Testing and Debugging Techniques
Model-Driven Software Engineering Techniques
Software System Performance and Reliability
Publication details
- Journal / source
- Anais do XXIX Congresso Ibero-Americano em Engenharia de Software (CIbSE 2026)
- Publisher
- Sociedade Brasileira de Computação
- Pages
- 121–135
- Publication date
- 11 May 2026