RobDWaller A Developer

Bio

Rob Waller Profile Picture

I am a software developer and manager with nearly a decade and a half of experience. I also built Twitter's largest anti-bot app.

View My GitHub Profile

Tweet Me: @RobDWaller

The Three Laws of Test Driven Development

October 24, 2018 Home > Blogs > The Three Laws of Test Driven Development Author: Rob Waller Tags: tdd, tests, unit tests

This is really just for my reference but I thought I’d note down the three laws of Test Driven Development as defined by Bob Martin. AKA Uncle Bob.

  1. You are not allowed to write any production code unless it is to make a failing unit test pass.
  2. You are not allowed to write any more of a unit test than is sufficient to fail; and compilation failures are failures.
  3. You are not allowed to write any more production code than is sufficient to pass the one failing unit test.

They’re very strict but useful, and while you may not follow them perfectly when writing your unit tests they’re useful to have in the back of your mind.

I also share Bob Martin’s excellent video on the three laws too: