Although we practise TDD on a daily basis, I was interested to see if we are applying all the practises correctly or see if we are missing out on anything.
The Jason presented what he called the baker’s dozen of TDD practises.
- Write a failing test
- Write the assertion first
- Don’t refactor with a failing test
- Isolate tests from each other
- See the test fail
- Organise tests to reflect model code
- Write the simplest code to pass the test
- Choose meaningful names
- Test one thing in each test method
- Refactor to remove duplication
- Keep test and model code separate
- Maintain your tests
The great way Jason reinforced these practises was to apply another great agile practise, pair programming. In pairs we applied TDD to solve various programming problems, e.g. generating Fibonacci numbers, FizzBuzz, etc. Solving these problems in pairs was the most enjoyable aspect of the course. By enforcing frequent pair rotation I met a lot of nice people plus I even got a taste of TDDing in C#!
So what did I find in the end? We are doing pretty well at youDevise. We nearly apply all the practises (we can probably do triangulation more). Overall, I think the course is a good introduction to TDD, especially learning through pair programming.