Changing untested code, without breaking it
In general, Legacy Code was not designed to be testable. Putting the existing codebase into a test suite is a very challenging step.
Problem is: without tests, every code change is risky. How do you know if you broke something?
Let's see what can get in the way and how you can solve every obstacle. Let's put some automated tests on your codebase!
🎓 Related articles
- 4 tips to refactor a complex legacy app without automation tools
How do you refactor a complex legacy application when you can't rely on automation tools?
- What's the difference between Regression Tests, Characterization Tests, and Approval Tests?
You may have heard one or the others. Now you're confused: is there a difference? Nope! Let me explain…
- Keeping dependencies up-to-date
My recipe for recovering from outdated dependencies and keeping healthy habits
- Technical Debt, Rewrites, and Refactoring
5 great talks on Legacy Code that I had the pleasure to host. Learn how to prioritize Tech Debt and rewrite systems incrementally.
- Is it OK to change code for the sake of testing?
It seems necessary to start adding tests on this code… but what if it makes things worse?
- Work faster and safer on untested code with Overcommitting
A technique you can resort to when you need to make risky changes.
- The best way to start testing untested code
Should you write E2E tests to cover more cases faster? Or is there a better approach?
- 4 developers working their way through Legacy Code
Practice working with code you've never seen before helps make it easier. Here's my selection of videos that will expose you to seasoned developers doing that!
- 7 techniques to regain control of your Legacy codebase
Working with Legacy Code is no fun… unless you know how to approach it and get your changes done, safely.
- A quick way to add tests when code has database or HTTP calls
You need to fix a bug, but you can't spend a week on it? Here's a technique to isolate problematic side-effects and write tests within minutes.
- The key points of Working Effectively with Legacy Code
This book is a reference. Here's my summary of its salient points so you understand why it's so recommended.
- Use the Mikado Method to do safe changes in a complex codebase
When a codebase is large and complex, it's risky to big changes. Here's a structured way to approach the problem.
- 3 steps to add tests on existing code when you have short deadlines
Here's a recipe you can follow when you want to add tests on Legacy Code, but you don't have much time to do so.