Evaluating the effectiveness of class-level LLM-generated test suites in Python
Bilal Al-Ahmad, M. Harshvardhan, Khaled El-Fakih, Anas AlSobeh
Abstract
Context: Large language models (LLMs) can generate unit tests quickly, but high structural coverage does not establish that those tests execute reliably or detect faults. Existing evidence often treats coverage as the principal outcome and rarely compares prompt strategies and models through mutation testing at class level. Objective: This study examines how prompt strategy and model choice shape the executability, structural coverage, fault-detection effectiveness, and structural quality of LLM-generated Python test suites relative to human-written suites. Method: We evaluate multiple prompt strategies across a diverse set of current LLM configurations on the ClassEval benchmark. The evaluation combines execution outcomes, line and branch coverage, Cosmic Ray mutation scores, and structural quality indicators. Primary analyses treat successful execution as a prerequisite; paired comparisons use only classes shared by the relevant executable subsets. Results: Structural coverage is consistently near its ceiling and offers little discrimination among configurations. Executability varies substantially. The proposed prompt performs strongly for mutation score, but no prompt dominates across models. Model choice explains more variation than prompt choice, and their interaction shows that prompt effectiveness depends on the selected model. Human and LLM suites are evaluated on unequal executable subsets, so their relative mutation scores do not establish superiority. Conclusion: Reliable assessment of LLM-generated tests should treat executability as a gate and combine coverage with mutation testing and structural quality indicators. In practice, model selection should precede prompt tuning.
Create a lesson
Related papers
Evaluating Shaker for Flaky Test Detection in Python Projects
Shared title terminologycs.SEGabriela Leal, Denini Silva, Leopoldo Teixeira
Specification Before Generation: A Pre-Registered, Five-Model Paired Evaluation of a Specification Frame for LLM-Generated Code in Money, Time, Idempotency, and Access Tasks
Shared title terminologycs.SESandeep Dhuri
Assessing the Construct Validity of Object-Oriented, Class-Level Code Quality Metrics
Shared title terminologycs.SEHera Arif, Miikka Kuutila, Paul Ralph
WebCraftBench: Evaluating Web Application Generation from a Software Testing Perspective
Shared title terminologycs.SEChenxu Liu, Zilu Zou, Peizhong Gao et al.
MergeReady-Bench: Evaluating and Improving Coding Agents Beyond Test Passing
Shared title terminologycs.SEPriyatham Kattakinda, Wenxiao Wang, Soheil Feizi
Exploring the Combination of Test Generation and Test Amplification for Regression Testing
Shared title terminologycs.SEDanilo Torquato, Breno Miranda, Antonia Bertolino