Yup, It's True, Coders Still Don't Believe in Testing

02/26/09

What I learned yesterday is that Rails coders everywhere still don’t believe in testing. I actually got an inking of this last week when I went to an interview and talked about testing.

I said, “I believe in testing”.

The Lead Developer said, “So, you do BDD testing?”

And as unpopular as this may sound, I said “No, I have done my due diligence and tried out BDD, but find that when writing a test first, I loose focus. So, I test as I go.”

The Lead Developer looked very concerned and said that they didn’t do BDD style testing either. And they didn’t really test. His contention was that if you know the application really well, then you should be able to manually test the application and you won’t have to expend the time in writing unnecessary tests.

I almost believed this once, and then I had to work with other developers on a project. Two things happened:
1. I no longer knew all aspects of the application like the back of my hand, because someone else was writing it.
2. The other developers broke anything not tested when refactoring or adding features.

I think these folks would argue that a really smart developer would read the code and instantly know the application. Also really smart developers would never introduce a bug and they would certainly know what things might be affected by their refactors and application upgrades.

This hasn’t been my experience. I have developed with some smart developers, but haven’t developed with any wise developers. I find that everything not nailed down with a test will be broken, often, no matter how often you tell developers to look out for it. I also have found that if I am coding alone on a project, having solid tests will put my mind and app at ease when I do major refactors. It saves me tons of time too, since I am not running around looking for obscure bugs. The tests tell me exactly where the bugs are.

I thought my interview last week was an aberration even though I have gone to several other interviews where the people admitted that they don’t do any testing. Yesterday, I reached a psychic tipping point though, when I met a CTO who doesn’t do any testing and doesn’t want to add testing. Also apparently the application doesn’t use REST; puts model code in the controller; puts helper, controller and model code in the views. The CTO knows that the code is really poor, because the ‘clever’ coder he has do most of the hard work isn’t able to adhere specs or finish anything he does. The rationale for this aching disaster is that they are currently funded on the CEO’s dime, and there is no time/money to do things right. The intention is a rebulid after their product is bought by a bigger fish.

I can’t say for sure. I was only there for an hour and a half, but I think writing tests for the code being refactored is the best approach to dealing with a code disaster that has been inherited. But then, I believe in testing.