Refactoring is not something distinct from writing code. It's integral to writing code. I do it constantly as I work. By reflex. I see something that can be improved and I improve it. Refactoring is not just something you do when tests fail. Doing it without tests is risky, tho.