What’s DAT Smell? Untangling and Weaving the Disjoint Assertion Tangle Test Smell
Oct 1, 2025·
,·
1 min read
Monil Narang

Hang Du
James A. Jones

Abstract
Writing and maintaining good unit tests is essential for quality assurance. However, developers often deprioritize such maintenance, leading to tests that exhibit code smells, are bloated, and may be less effective. In this work, we characterize a novel test-code smell—Disjoint Assertion Tangle (DAT)—which occurs when a test method verifies multiple, logically unrelated behaviors that can be separated. We propose a program analysis-based approach that automatically detects DATs and refactors them into separate focused test methods. We implemented this approach as a tool called U2W. By separating unrelated testing logic, U2W enhances readability, maintainability, and fault localization, while exposing hidden test clones and duplicated code. It then seizes these opportunities by converting structurally similar tests into compact, parameterized unit tests (PUTs), reducing redundancy and enabling more scalable, extensible test designs.
To evaluate our approach and tool, we conducted a number of evaluations: (1) a large-scale, quantitative study to study the prevalence of the test smell and the effects of their refactoring, (2) a user survey to assess developers’ opinions and preferences of the unrefactored and refactored test code, and (3) pull requests that were issued to original project maintainers to assess the acceptability of our refactorings. Our quantitative study was conducted on 42,334 tests across 49 open-source projects. We found the DAT smell in 95.9% of the subject projects, affecting an average of 8.59% of analyzed tests. In total, we identified and refactored 3,638 smelly tests, untangled them into 31,837 test-execution logics, and then weaved 14,343 of them into 1,713 extensible PUT methods. These refactorings reduced the executable test-code lines in smelly tests by an average of 36.33%. Our user survey involving 49 industrial and academic participants demonstrated strong preference for our refactored test cases over their original, unrefactored versions. Additionally, we submitted 19 pull requests based on our automated refactorings; 16 of these were accepted by project maintainers. These results suggest that U2W effectively improves test-suite quality, and validate our novel test smell aligns closely with developers’ intuitions and practices.
Type
Publication
In ASE 2025: 40th IEEE/ACM International Conference on Automated Software Engineering
Tip
Our large-scale study across 49 open-source projects shows that DATs are highly prevalent (affecting ~8.6% of tests) and that U2W’s automated refactorings reduce test-code size by 36% on average while exposing opportunities for parameterization. Developer surveys and accepted pull requests further confirm that U2W’s refactorings align with developer preferences and improve real-world test quality.