Toward a Language-Agnostic Approach to Detect Test Smells

Públio Silva, Carla Ilane Moreira Bezerra, Ivan Machado · 2024

Tests play a crucial role in software development by ensuring code quality. However, test code can suffer from “smells” — poor implementation choices that hinder maintainability and evolution. Numerous studies have addressed test smells in various programming languages, proposing tools for detecting them in Java, C++, Scala, and others. These tools employ techniques such as information retrieval, metrics analysis, and abstract syntax tree (AST) parsing. However, their focus on specific languages limits their generalizability and applicability to other languages and test frameworks. This challenge is similar to issues found in code smell detection and static code analysis. Therefore, this work proposes a language-agnostic approach to detect test smells. Our approach leverages AST parsing to extract relevant information from the test code, followed by test smell detection based on this extracted data. This method aims to facilitate the detection of test smells across various programming languages and test frameworks, enhancing the tool’s generalizability and usability. To check the viability of our approach, we created a proof of concept using two test smells and two different languages.

Read the paper · More papers on PaperTik