tags |
---|
TDD, testing |
Let's say you interested in TDD but you just can't figure out how to write a test before you write the code. Here's a foolproof exercise that let's you experience the TDD workflow in spite of that block:
- Change the code as usual
- Write a test that only passes after the change
- Revert to before 1
- Type the test again (copy/paste is cheating & invalidates the warranty of the exercise)
- Make it compile by changing the code
- See it fail
- Change the code to make it pass
(original tweet: https://twitter.com/KentBeck/status/1421257650113634304?)