Learn Test-Driven Development (TDD) from Uncle Bob

The jury is in. The controversy is over. The debate has ended. The conclusion is: TDD works.

We have knowledge sharing session every two weeks. Normally we just share the new technics we learn in the sprint. This week is different. We watched the famous Uncle Bob’s three TDD rules video.

  1. You can’t write any production code until you have first written a failing unit test.
  2. You can’t write more of a unit test than is sufficient to fail, and not compiling is failing.
  3. You can’t write more production code than is sufficient to pass the currently failing unit test.

The benefits we can get from following these rules are:

  1. Saving time on debugging.
  2. Confident. All tests passed means deployment ready.
  3. Documents itself.
  4. Testable, because they’re testing ready.

As for me, I do write unit tests but only when the code is completed. Sometimes, we like to ask other team members to write unit tests independently. But this time, I’m really intriged and like to try from next task.

I’ll share my experience also in this article.