Two key aspects of extreme programming (XP) are unit testing and merciless refactoring. Given the fact that the ideal test code / production code ratio approaches 1:1, it is not surprising that unit tests are being refactored. We found that refactoring test code is different from refactoring production code in two ways: (1) there is a distinct set of bad smells involved, and (2) improving test code involves additional test-specific refactorings. To share our experiences with other XP practitioners, we describe a set of bad smells that indicate trouble in test code, and a collection of test refactorings to remove these smells.

Coding Tools and Techniques (acm D.2.3), Testing and Debugging (acm D.2.5), Distribution, Maintenance, and Enhancement (acm D.2.7), Management (acm D.2.9), Software Management (acm K.6.3)
Software (theme 1)
CWI
Software Engineering [SEN]
Software Analysis and Transformation

van Deursen, A, Moonen, L.M.F, van den Bergh, A, & Kok, G. (2001). Refactoring test code. Software Engineering [SEN]. CWI.