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

Conference Paper (2026)
Author(s)

Xutong Liu (TU Delft - Electrical Engineering, Mathematics and Computer Science)

Andy Zaidman (TU Delft - Electrical Engineering, Mathematics and Computer Science)

Department
Software Technology
DOI related publication
https://doi.org/10.1145/3803437.3805600 Final published version
More Info
expand_more
Publication Year
2026
Language
English
Department
Software Technology
Pages (from-to)
1529-1538
Publisher
ACM
ISBN (electronic)
9798400726361
Event
ACM International Conference on the Foundations of Software Engineering, FSE 2026 (2026-07-05 - 2026-07-09), Montreal, Canada
Page Views
73
Reuse Rights

Other than for strictly personal use, it is not permitted to download, forward or distribute the text or part of it, without the consent of the author(s) and/or copyright holder(s), unless the work is under an open content license such as Creative Commons.

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.