I’m sure many of you have mixed feelings about testing, and get shivers on the spine when someone mentions TDD/BDD.
Well, I’m a big adept of testing, specially TDD and its newest child, BDD.
Unit testing in general is a tricky skill to learn, and requires a lot of motivation and faith on what you are doing. I have started in the world of Unit Testing about 4 years ago, and TDD/BDD ~3 years ago and the more I learn, the more I see it’s actually an art.
I used to defend BDD religiously, and I was one of them, heck, I even looked a testless application from behind the lens of prejudice, for me, it was basically crap.
Of course, that’s how our mind works. We see the world as we are, and I was over-reacting, basing my judgement on some internalized archetyped beliefs:
* Code without tests is crap
* Rails code must be tested, if you don’t test you are a worthless and doesn’t deserve to live
* BDD is the new tendency, everyone should be using it
* Outside-in! Outside-in! Or die!
Now, don’t take me wrong. Unit-testing, TDD and BDD are very valuable disciplines, but the message is being given in the wrong way, in my opinion.
I still love BDD. Cucumber for me is one of the most well-developed pieces of software, it’s really amazing. rSpec makes unit-testing fun and clear.
Critical features should be always unit-tested, following TDD/BDD or not. However, there’s a culture out there that makes you believe you should test every freakin’ aspect and artifact of you application.
That’s insane. That’s overuse of testing. That definetly doesn’t relate to the pragmatic/agile way in my opinion.
Take Selenium, for example. Cucumber+Selenium is a killer combo, in both senses. It works nicely and you can test JS and Ajax features, but it is just too slow. Every time you launch it, it takes up to 10 seconds to launch on a modern computer, sum that with Cucumber’s startup time, and every time you want to go through it, you loose around 15 seconds.
Every successful application I have worked on have started with little or no unit-testing, and once the money started flowing, we had the time and resources to build a better testing infra-structure. That’s a point agains BDD, unfortunately. As magic as it sounds, the real-world calls, and you are forced to code for food when you are starting.
So, I think it depends on:
* Resources: Microsoft can do BDD from the beginning 
* Time: Tight dealines calls for essential things only
* Skills: If you can sing BDD in 5 languages, then maybe you can BDD
for every programming artifact you create
* Environment: The company you work for might already have a very deep testing culture that it end up being simpler do follow TDD/BDD or unit-test your stuff, however, you can still overdo it.
* Patience: Come on. Selenium is just too slow.
So, whenever I am on my pragmatic mode (I still fall to my perfectionist side sometimes) I just have one rule: Getting Things Done and well. If for that I need to test something to make sure it will work as I expect, then so be it. If I judge it might go without tests, then, so be it, too. In the end, I’m giving priority to the most important resource we all have: Time.