tags:

views:

197

answers:

5

Duplicate:

Type of Projects where Unit Testing is useless
When to unit-test vs manual test
Is Unit Testing worth the effort?

I am wondering why I should write tests for things that I already test manually myself. I don't write rspec tests or anything like that. To test, I'll write something then go to the browser and make sure that changes do what I want. I've heard this methodology described as "error driven development".

The applications I write now are generally small in scope and size. I am the only developer (typically) and so I don't have to worry about incorporating other people's code into my own tests.

I can see the need for testing large scale applications with hundreds of forms. But for the smaller applications that I am developing on my own, writing tests take much longer than just filling in the info myself. I've heard a lot of developers advocating test driven development and I just haven't "seen the light" yet. It seems like a great idea but I just can't justify the amount of work that writing tests (seems) to require.

+3  A: 

One word: regression. Making sure you don't break something that used to work is well worth writing the tests.

Otávio Décio
This is so true... I am a single developer as well and even though I do not always use TDD, having a few unit tests in really critical areas has really proved to be a huge timesaver for me for this very reason.
Adrian Grigore
A: 

I do error driven development as well but tests still prove to be useful in cases with sql queries, page loading, routing and user inputs. There is quite a bit of copy-pasting that goes on in some stances of web development you never know what mistakes you'll run into. It's always better safe than sorry kind of approach when thinking about testing.

Ayo
A: 

Even with small applications, having to manually check the code can be very time consuming. Remember that even if you change one piece of the application, you can still break another piece. Having to test functions A, B, C and D just because you altered function E is going to drive you insane without tests. Spend the small amount of time coding tests now so that if the applications does at some point grow or leave your hands, it'll be easier for everyone.

Brandon
A: 

When you get promoted to your boss's job, will the next developer be as diligent as you? And will s/he know the appropriate manual tests to perform after modifying your code?

Adam Liss
A: 

At first, you won't care if you write tests or not. It will be annoying, distracting, and you will just give up and write code directly. Then 3 months from now, you will go back to maintain some piece of code, make a small change, and customers will start calling in about how feature X broke. After 3 days of digging through code, you will find some regression that you fix, and after several drinks and a mini vacation forget about this problem again.

Another month will pass, some other minor fix will be needed, and again users are calling in about feature X. This happens to you four or five times, and finally you look back, realize you wasted 3 days five times, and wish you had the three work weeks of your life back for build fun stuff. From then on, you will write at least a few unit test, sighing while you wish you had time for more.

Zak