Skip to content
Book Open access

Can LLMs Make Software Testing Greener? An Empirical Study on JUnit Test Energy Reengineering

Jul 2026 · SIGSOFT FSE Companion · pp. 1529-1538 · 0 citations · 44 references
Computer Science

TL;DR

An exploratory study to examine whether current Large Language Models are capable of reengineering unit tests to improve their energy efficiency while maintaining test effectiveness indicates that only a small subset of unit tests shows improved energy efficiency, with negligible impact on test effectiveness.

Abstract

Software testing is essential to ensure the reliability of software. To that end, test suites are often executed repeatedly, due to frequent developer validation runs, and practices like continuous integration. This repeated execution leads to substantial energy consumption and thus potential environmental impact. In this paper, we conduct an exploratory study to examine whether current Large Language Models (LLMs) are capable of reengineering unit tests to improve their energy efficiency while maintaining test effectiveness. Our results indicate that, using a straightforward prompt, only a small subset of unit tests shows improved energy efficiency, with negligible impact on test effectiveness. Subsequently, we scrutinize our results for potential reasons for the relatively low number of energy-reengineered unit tests. We observe that energy efficiency related information is scarce on prominent platforms like StackOverflow and GitHub. This scarcity of information potentially affects how LLMs can be trained on the topic of energy efficiency.

Read PDF

Similar papers

Preprint Aug 2026

Beyond FLOPs: Energy-Aware Knowledge Distillation for Sustainable LLMs on Code-Related Task

Background: Large Language Models (LLMs) are increasingly being applied to Software Engineering (SE) tasks, achieving high accuracy across problems such as clone detection, vulnerability prediction, and code summarization. However, their high computational demands and energy consumption raise sustainability concerns and hinder their use on consumer hardware and resource-constrained platforms. A common way to report the computational cost of an LLM in the literature and industry is to use the number of Floating Point Operations (FLOPs) required to perform a pass over the network. Aims: This paper investigates the implications of energy-aware knowledge distillation for SE, aiming to improve model efficiency while maintaining performance and to determine whether FLOPs is a reliable energy-aware metric. Method: We conduct a controlled experiment using Morph, a Many-Objective Optimization-based distillation methodology, to empirically examine whether FLOPs accurately reflect energy consumption in Clone Detection and Vulnerability Prediction tasks. We extend this methodology to include energy-surrogate models that directly estimate CPU and GPU energy consumption during optimization, and we apply Morph to generative tasks using CodeT5+ for code summarization. Results: Our results show that FLOPs is not always a reliable indicator of energy consumption, and better results can be achieved by using energy-surrogate models. Distilled student models can reduce inference energy consumption by up to 90\% and memory usage by 86\%, with only modest accuracy trade-offs. Conclusions: Energy-aware knowledge distillation when guided by direct energy surrogates rather than FLOPs can improve the energy consumption, sustainability, and deployability of LLMs for SE applications, enabling efficient models on consumer hardware.

Enrique Barba Roque, Luís Cruz, Annibale Panichella · 0 citations
Review Aug 2026

Developer Attitudes and Practices Towards Optimizing Software Energy Consumption

Context: Software significantly influences the efficiency with which hardware resources are utilized, yet software energy consumption is seldom treated as a first-class concern in day-to-day development practice. Objective: This study investigates professional developers'attitudes, decision-making, and development practices related to software energy consumption, with particular emphasis on how energy considerations are recognized, assessed, and acted upon during software development. Method: To this end, we conduct an online survey with 134 software developers. Our study combines quantitative analyses with a qualitative open-card sorting of free-text responses to characterize perceptions, practices, and reasoning patterns around energy consumption. Findings: Energy consumption is explicitly considered in only a minority of projects. More commonly, developers influence energy use indirectly by optimizing proxy properties such as execution time and CPU utilization. Responses to scenario-based questions reveal systematic blind spots in this mental model, including cases in which performance improvements increase energy consumption or exhibit no correlation. We also identify organizational disincentives, limited tooling, and educational gaps as major barriers to adoption. Implications: (1) Institutionalize energy-aware approaches through visible flagship deployments that demonstrate value, (2) expand research and education on energy-performance trade-offs, and (3) develop practical, developer-oriented measurement and feedback tools that lower adoption barriers.

Max Weber, Alina Mailach, Florian Sattler et al. · 0 citations
Open access Aug 2026

Property-based testing in Python: empirical insights

These findings provide the largest empirical characterization of PBT in Python to date, highlight developers’ difficulties in adopting the technique, and expose limitations of current tool support.

Isadora de Oliveira, Arthur Lisboa Corgozinho, Henrique Rocha et al. · 0 citations
#software testing Preprint Aug 2026

Benchmarking the Titans: A Multi-Dimensional Empirical Evaluation of LLM Code Generation Quality in the .NET Ecosystem

An automated, multi-dimensional evaluation framework for C# code generation, applying it to four state-of-the-art LLMs: GPT, Gemini, Claude, and Grok is presented and a substantial gap between correctness and quality attributes is revealed.

Seyed Mohammad Mahdi Ghalandarian, Majid Bazargani, Masoumeh Taromirad · 0 citations
Preprint Aug 2026

Code Health in LLM-Based Test Generation: Effectiveness and Token Efficiency

Coding agents powered by Large Language Models (LLMs) are now prominent in software engineering. Previous work has shown that AI tools perform better on high-quality source code that is easy to maintain. In this study, we investigate how the effectiveness of LLM-generated unit tests varies across maintainability levels measured by CodeScene's CodeHealth (CH). We assess test effectiveness using traditional coverage metrics and mutation score across Python, Java, and C++. Moreover, we study how code with different levels of CH translates into input tokens using common industrial tokenizers. Our results suggest that CH provides a weak but consistent signal of LLM-generated test effectiveness and is negatively correlated with input-token count. These findings provide further evidence for a relationship between maintainability and LLM-based software development.

Freya Wirdemann, Markus Borg, Nadim Hagatulah et al. · 0 citations

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