Introduction to classic TDD
Last updated
Last updated
In his book, , Kent Beck describes three strategies for unit testing:
If your test expects a zero from a method, then return 0. Literally. It's the smallest code change we can make to turn our test green. Usually you use this when you cannot tell how to implement certain functionality, or your previous steps were too large and you cannot figure out what went wrong. Something that works is better than something that doesn’t work!
When you are pretty sure of the code you need to write, so write it and see if the test passes. The majority of the time you will use this method to move forward with TDD quickly.
Where you want to generalise certain behaviour but you aren't sure how to do it. Start with fake it and add additional tests that force the code to be more generic along a certain dimension.
You should be able to understand and remember the TDD cycle (Red, Green, Refactor)
You should be able to understand and remember the the three methods of moving forward in TDD
Success criteria
You should able to test drive the Fizz Buzz kata using classic TDD. Just solving the problem does not count as success!