Enhancing Cross-Project Test Smell Detection via Test Code Feature Engineering and Ensemble Learning
摘要
In software development, testing is a crucial process that ensures the quality and maintainability of software systems. Recent research shows that test smells in test cases negatively affect the cost and overall health of software projects. Earlier research on test smell detection has largely relied on heuristic or rule-based techniques, which depend on subjectively defined thresholds and often fail to generalize across projects. More recent studies have introduced machine learning (ML) to automate detection; however, their effectiveness remains limited because they rely almost exclusively on features extracted from test code. To address these limitations, this study makes two key contributions. First, we construct an enriched dataset by extending an existing ground-truth corpus of 9,633 manually labeled Java test cases, linking each test class. Second, we propose an enhanced detection framework based on ensemble learning, combined with test code feature selection, and evaluate it across 59 Java projects covering four test smells—Eager Test, Mystery Guest, Resource Optimism, and Test Redundancy. Our results demonstrate substantial improvements in F1-score compared to previously reported cross-project studies, indicating significantly stronger generalization and more robust detection performance.