TDD is really awesome. If you’re starting now, just keep repeating it to yourself while you think you’re wasting time doing it, but keep doing it. When your project gets big enough, you won’t be able to be more grateful to your test suite. Specially when features that you didn’t anticipate start being added. And they will be added.

I have been watching some videos about it lately, like, Test-Driven Design from the AngularJS team, Roman Numerals Kata with Jim Weirich, that although the quality of the video is not so good, the quality of the code is, and JavaScript Testing Tactics with Justin Searls, who talks about patterns, tools and strategies to write tests, specially interesting on asynchronous code testing.

I strongly believe that in order to write good tests you’ll first write bad tests and like writing, talking to somebody you don’t know or public speaking, the hardest part is starting. Starting boots your brain and it suddenly discovers a lot of cases that need to be tested.

Even if you have to set up a lot of things before actually testing, that already tells you something useful. Your code is probably more complex than it should be. But only by writing it that you can start to notice the patterns and improve the design. Code that is easy to test, is code that is easy to use.

The cool thing about TDD is that you have to actually think about the problem, and write tests for the code you want to have. After the code is surrounded by tests that define how the application works, and what are the interfaces, you are free to refactor the code and make it as beautiful as you can, without losing and functionality. Securing yourself from your future self that will do whatever to mess up your code. Awesome.