John Moon

Benefits of Test Driven Development

The past week I have taken a deep dive in the big boys tool club, TDD
with capybara and rspec. This post isn’t to discuss about tools for TDD,
but the WHY companies and individuals should write test for their code.

I want to start of with the negatives of TDD.

Testing takes time, and maybe the deadlines approaching. We hear
it all the time. We don’t have time to test, because we need to hit the
deadline. It will slow us down… WRONG. It will take you far more time
and brain power to debug or make changes to your code with no tests.
More on the later

Testing isn’t perfect, and sometimes we can waste of lot of time writing tests.

We can probably double our code output if we didn’t have to write
any test

Thats all I could think of for reasons not to write test. If I must say,
those are some terrible reasons not to write tests.

Why you should test

It’s faster! Some of you are probably thinking, “you just said
testing takes time and you would double your code output if you didn’t
write test. LIES.” Well it’s true that we may be able to spin out code
faster, but in the long run, we would most likely lose. If we had to debug
our app that has no test, but is twice as large. How long do you think
it would take to debug such an application. On top of that the
headaches, the tears, and depression is simply not worth it

It pushes us for better design. By this I mean that writing tests
helps us see options when it comes to implementation. While we think and
decide what we want to test, and how we want to test it. This additional
time we’re spending on our application design helps us to pick better
options. I’m not saying it’ll be the perfect design and you won’t have
to touch it. But I believe it will be far better off, than if you went
straight into implementation

We spend less time implementing new features to our existing code
base. This going back to point number 1, of being confident of modifying
our code because of the test.

We can’t afford not to test. Not writing test is expensive. It would
cost the business more, in the long run because of the time we have to
put in to debug. This slows production, and ultimately costs us more.

It’s a chepaer alternative

I think testing is important for all these reasons. I can’t imagine a
company who don’t test their application. That shows me they don’t care
what the code looks like as long as it ‘works.’ What rubbish and shotty
job.

I would love to work at a company that respects their clients and their
employees time to implement testing in all levels (acceptance and unit
testing).