Firstly, welcome to the club of poor good programmers who must fix the crimes committed by their worst colleagues. :(
I had such an experience. In this case, one of the recommended practices is to develop tests for new features. You cannot stop now and develop tests for the entire application. What you can do is every time you have to write new tests to develop this function. If this feature requires changes in some sensitive locations, start testing for those locations.
Refactoring is a big problem. Ideally, if you want to divide a 5k row class into 10 normal-sized classes, you should first develop a test case for a large class, then do the reprocessing and then run the tests again to verify that you didn't break anything. This is very difficult in practice, because when you change the design, you change the interface, and therefore you cannot perform exactly the same tests. So, every time you have to make a difficult decision, which is the best way and what is the minimum test case that covers your ass.
For example, sometimes I performed a phase factorium: 1. developed tests for a poor large class 2. developed a new well-designed code and changed the old class to the facade of my new code. 3. checked the test case developed in No. 1 to confirm that everything works 4. developed new tests that confirm that each new (small) auxiliary module works well 5. reorganized code, i.e. Removed all references to a large old class (which became a light facade) 5. deleted the old class and its tests.
But this is the worst case scenario. I should have used it when the code I am changing is extremely sensitive.
Good luck with your hard work soon. Get ready to work overnight, and then get 20 bug reports from QA and an angry email from your boss. :( Be strong. You're on the right track!
Alexr source share