
Ask HN: How to build a test harness for a legacy system? - marsrover
I&#x27;m working with a legacy system that has no automated testing. I have a section of code that I need to refactor or it is going to get increasing more coupled. First, I tried going through the Legacy Code Change Algorithm but when trying to break dependencies, I&#x27;m moving a lot of code around (maybe I&#x27;m doing it wrong?).<p>I&#x27;m starting to think now that it would be a good idea to build automated acceptance tests around the functionality that I want to refactor, before breaking dependencies. Should I revisit how I am breaking dependencies or would it be worthwhile to take this path?<p>Any other words of wisdom you can impart my way?
======
Rjevski
If it's got a web interface I suggest starting with browser-based testing like
Selenium. It won't be as good as unit tests but will catch the obvious
fuckups. I plan on doing this to a legacy project at my employer's and I
already know it would've caught a few production fuckups we had lately - 500
error on the homepage, etc.

This also means you don't even need to be familiar with the code base, but
just know how to use the web interface as a normal user would.

