Evaluating Large Language Models in Detecting Test Smells

Keila Lucas,Rohit Gheyi,Elvys Soares,Márcio Ribeiro,Ivan Machado
2024-07-30
Abstract:Test smells are coding issues that typically arise from inadequate practices, a lack of knowledge about effective testing, or deadline pressures to complete projects. The presence of test smells can negatively impact the maintainability and reliability of software. While there are tools that use advanced static analysis or machine learning techniques to detect test smells, these tools often require effort to be used. This study aims to evaluate the capability of Large Language Models (LLMs) in automatically detecting test smells. We evaluated ChatGPT-4, Mistral Large, and Gemini Advanced using 30 types of test smells across codebases in seven different programming languages collected from the literature. ChatGPT-4 identified 21 types of test smells. Gemini Advanced identified 17 types, while Mistral Large detected 15 types of test smells. Conclusion: The LLMs demonstrated potential as a valuable tool in identifying test smells.
Software Engineering
What problem does this paper attempt to address?
### Problems the Paper Attempts to Solve This paper aims to evaluate the ability of large language models (LLMs) to automatically detect "test smells" in test code. Test smells refer to coding issues that arise during the writing of test code due to improper practices, lack of effective testing knowledge, or project deadline pressures. The presence of these issues can affect the maintainability and reliability of the software. Although existing tools can already detect test smells using advanced static analysis or machine learning techniques, these tools often require significant effort from users to utilize and support a limited number of languages. Additionally, these tools typically do not provide detailed explanations and improvement suggestions. Therefore, this paper explores whether LLMs can serve as an effective tool to identify and mitigate test smells, thereby improving software quality, by evaluating the capabilities of three large language models (ChatGPT-4, Mistral Large, and Gemini Advanced) in detecting 30 different types of test smells across seven different programming languages.