Andrea Della Corte ~ principles bookshelf invitation about resume subscribe rss

Test Driven Development

On June 22, 2019 in software development 1 minutes read

Table of Contents

TDD is an iterative software development process where you first write the test with the idea that it must fail.

This is a different approach to the traditional development where you write the application functionality first and then write test cases. The major benefit of this approach is that the code becomes thoroughly unit tested.

Why use TDD?


  1. Write a Failing Test - Understand the (user) requirements/story well enough to write a test for what you expect. (the test should fail initially - hence it being “Red”)
  2. Make the (failing) Test Pass - Write (only) the code you need to make the (failing) test pass, while ensuring your existing/previous tests all still pass (no regressions).
  3. Refactor the code you wrote - if you have time to tidy up the code you wrote to make it simpler (for your future self or colleagues to understand) before you need to ship the current feature, do it.

Other Software Development Pages

Join the Principles Newsletter and get new posts in your inbox every Monday.
* indicates required