From the course: Agile Software Development: Refactoring

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Test-driven development (TDD)

Test-driven development (TDD)

From the course: Agile Software Development: Refactoring

Start my 1-month free trial

Test-driven development (TDD)

- [Instructor] Refactoring is about changing the internal structure of your code without changing it's external behavior. Rigorous testing is the foundation of refactoring. Without excellent tests that verify the correct behavior of your code, you can't be sure that you haven't altered the code's external behavior. We'll use a practice called test-driven development, or TDD for short. TDD is the practice of writing tests first. We'll write automated tests that prove the correct behavior of our code. When we write new code, TDD will guide us toward writing the right code. And when we improve existing code, TDD gives us guide rails that make it safe to do so. Test-driven development is a three step dance. The first step in the dance is to write a new test that fails, we said the test has gone red. Then we write the minimum code until that test passes and all the other tests pass as well. We say the tests have gone green. Then we refactor to improve both the production code and the…

Contents