A fundamental part of the Agile methodology is refactoring: rewriting small sections of code to be functionally equivalent but of better quality. Don’t forget to test the refactoring! What do you test? The answer is simple: you test whether the code really is functionally equivalent.
In this article by Jeroen Mengerink Jeroen Mengerink explains how testing the refactoring is being executed.