Gil Zilberfeld
How to TDD in legacy code
#1about 6 minutes
Why standard TDD fails in complex legacy code
Real-world code complexity and dependencies make the simple red-green-refactor cycle difficult and risky without existing tests.
#2about 3 minutes
A modified TDD process for existing codebases
A four-step approach is introduced, involving characterization tests and pre-refactoring before applying the standard TDD cycle.
#3about 7 minutes
Using characterization tests to create a safety net
Characterization tests are written to capture the current behavior of a system, including its bugs, providing a baseline for safe refactoring.
#4about 6 minutes
A step-by-step guide to fixing a bug
A bug is fixed by first writing a failing test, making the minimal code change to pass, and then refactoring both production and test code for clarity.
#5about 6 minutes
Pre-refactoring code to prepare for new features
Before adding new functionality, the code is refactored using techniques like guard clauses and switch statements to make the insertion point clear and simple.
#6about 3 minutes
Adding a new feature with the TDD cycle
After preparing the codebase, a new feature is added by writing a failing test and then implementing the minimal code required to make it pass.
#7about 5 minutes
Core principles for safe and fast development
The key takeaways are minimizing risk, separating new functionality from cleanup, and consistently leaving the code better than you found it.
#8about 9 minutes
Q&A on BDD and testing untestable code
The discussion covers the role of BDD and how to handle untestable code using tools like approval tests or snapshot testing to capture system behavior.
Related jobs
Jobs that call for the skills explored in this talk.
Hubert Burda Media
München, Germany
€80-95K
Intermediate
Senior
JavaScript
Node.js
+1
MARKT-PILOT GmbH
Stuttgart, Germany
Remote
€75-90K
Senior
Java
TypeScript
+1
Eltemate
Amsterdam, Netherlands
Intermediate
Senior
TypeScript
Continuous Integration
+1
Matching moments
02:33 MIN
Why you might not need JavaScript for everything
WeAreDevelopers LIVE – You Don’t Need JavaScript, Modern CSS and More
03:31 MIN
The value of progressive enhancement and semantic HTML
WeAreDevelopers LIVE – You Don’t Need JavaScript, Modern CSS and More
03:16 MIN
Improving the developer feedback loop with specialized tools
Developer Time Is Valuable - Use the Right Tools - Kilian Valkhof
03:58 MIN
Making accessibility tooling actionable and encouraging
Developer Time Is Valuable - Use the Right Tools - Kilian Valkhof
07:27 MIN
Comparing software maintenance to tattoo cover-ups
Devs vs. Marketers, COBOL and Copilot, Make Live Coding Easy and more - The Best of LIVE 2025 - Part 3
09:00 MIN
Navigating the growing complexity of modern CSS
WeAreDevelopers LIVE – You Don’t Need JavaScript, Modern CSS and More
02:49 MIN
Using AI to overcome challenges in systems programming
AI in the Open and in Browsers - Tarek Ziadé
12:00 MIN
Dealing with browser regressions and compatibility issues
WeAreDevelopers LIVE – You Don’t Need JavaScript, Modern CSS and More
Featured Partners
Related Videos
Write tests you love, not hate
Jens Happe
Breaking the Bug Cycle: TDD for the Win
Nadeen Hussein
How To Test A Ball of Mud
Ryan Latta
Why you must use TDD now!
Alex Banul
TDD for Vue.js Developers
Markus Oberlehner
Treat yourself - A tale about dog training and test-driven development
Mirjam Aulbach
How not to test
Golo Roden
Test Driven Development with JavaScript
Sascha Depold & Parinaz Roghany
Related Articles
View all articles



From learning to earning
Jobs that call for the skills explored in this talk.

Code Healers LLC
Hinesville, United States of America
Remote
€30-40K
Intermediate
Senior
.NET
React
JavaScript
+2

Code Healers LLC
Hinesville, United States of America
Remote
€20-30K
Junior
Intermediate
React
JavaScript
TypeScript
+1

Confideck GmbH
Vienna, Austria
Remote
Intermediate
Senior
Node.js
MongoDB
TypeScript


Visonum GmbH
Remote
Junior
Intermediate
React
Redux
TypeScript

Patronus Group
Berlin, Germany
Senior
Kotlin
Spring Boot
Amazon Web Services (AWS)

Douglas GmbH
Düsseldorf, Germany
Intermediate
Senior
React
TypeScript

Power Plus Communications
Mannheim, Germany
Intermediate
Senior
Python
Unit Testing
Automated Testing

UserTesting, Inc.
Edinburgh, United Kingdom
Intermediate
Go
Bash
Python
Node.js
CircleCI
+6