###### tags: `TDD` `testing` # Another precious TDD exercise by Kent Beck ![](https://i.imgur.com/L6SAg7M.png) 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: 1. Change the code as usual 2. Write a test that only passes after the change 3. Revert to before 1 4. Type the test again (copy/paste is cheating & invalidates the warranty of the exercise) 5. Make it compile by changing the code 6. See it fail 7. Change the code to make it pass (original tweet: https://twitter.com/KentBeck/status/1421257650113634304?)