unit testing

Craig Howard craig.howard at earthlink.net
Fri Oct 5 05:38:05 EDT 2007


On Oct 4, 2007, at 3:02 PM, brad wrote:

> Does anyone else feel that unittesting is too much work? Not in  
> general,
> just the official unittest module for small to medium sized projects?
>
> It seems easier to write some quick methods that are used when needed
> rather than building a program with integrated unittesting. I see the
> value of it (the official unittest that is)... especially when  
> there's a
> lot of source code. But this...
>
> if len(x) != y:
>     sys.exit('...')
>
> is a hell of a lot easier and quicker that subclassing  
> unittest.TestCase
> on small projects :)
>
> Do others do their own "informal" unit testing?
>
> Just curious,
>
> Brad
> -- 
> http://mail.python.org/mailman/listinfo/python-list

Brad:

If the program is more than 100 lines or is a critical system, I  
write a unit test. I hate asking myself, "Did I break something?"  
every time I decide to refactor a small section of code. For  
instance, I wrote an alarm system in Python for a water treatment  
plant. If the chlorine, pH, or turbidity are out of spec, an email  
message is sent to the plant operator's pager. Because of the nature  
of the alarm system, extensive field testing was out of the question.  
Unit testing was the only way to ensure it worked without disrupting  
the plant operation.

Craig




More information about the Python-list mailing list