What’s the hardest thing in test-driven development or unit testing in general?
The syntax or the tools aren’t the problem – you can learn those enough to get started in 15 minutes.
The problem is how to take some vague idea in your head about what you want to do, and turn it into something that verifies some function works… before you even wrote the damn thing!
People tell you to use TDD. But how can you possibly write a test for something that doesn’t exist? I don’t even know what the function is going to do yet – or if I actually want two functions instead of one – and instead you want me to think of a test for it? Are you crazy?
How do all those people who tell you to use TDD do it?
That’s the thing – test-driven development requires thinking of your code in a different way. And nobody ever tells you how to do that.