[Tutor] Do you use unit testing?

Alan Gauld alan.gauld at btinternet.com
Tue Nov 17 09:01:32 CET 2009


"Modulok" <modulok at gmail.com> wrote

> How many of you guys use unit testing as a development model, or at
> all for that matter?

Personally I use unit testing for anything that I'm getting paid for....
Occasionally I use it for something I'm doing for myself, but only
if its quite big - several modules and over say, 500 lines of code.
So for small single-file utilities etc that I only use myself I wouldn't 
bother.

> I just starting messing around with it and it seems painfully slow to
> have to write a test for everything you do.

Its a lot more painful and slow to have to debug subtle faults in
code you wrote 6 months ago and that don't throw exceptions
but just quietly corrupt your data...

The real  benefits of unit tests are:
a) You test stuff as you write it so you know where the bug must lie
b) You can go back and run the tests again 6 months later,
c) if you have to add a new test its easy to make sure you don't break
     what used to work (regression testing).

HTH,


-- 
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/ 




More information about the Tutor mailing list