Where did you learn to unit test? How did you learn?

Sean 'Shaleh' Perry shalehperry at attbi.com
Tue Apr 29 11:36:42 EDT 2003


On Tuesday 29 April 2003 07:38, Christopher Blunck wrote:
> Hi all-
>
> This is my second generic question posted to c.l.p (the first was 'How
> many of you are Extreme Programmers?') but it seems like a somewhat
> appropriate discussion for the group.
>
> I've noticed in my development that Python programmers (in general)
> write more unit tests than their java counterparts.  If I download a
> project off of jakarta.apache.org, it very rarely has unit tests.
> However, when I download a python module, it frequently has unit
> tests.
>

I believe this is due in part to Python being an interpreted language.  With 
Java you have a compiler there to catch many problems but with Python most 
bugs, misfeatures, etc. can only be found by exercising the code.  Python 
coding is all about handling the runtime which makes for rapid writing of 
code but almost requires stronger testing.

As Skip said, I got into unit testing by writing test cases to prove bugs were 
fixed.  When more bugs were found either new tests were written or old ones 
improved.

After that I got into test writing as a way to actually write my applications.  
One thing I find hard for me is interface design.  So now I write the code 
that uses my class or function before I write the function.  This helps me 
identify the ways I want the code to work and also provides me with a test 
infrastructure.





More information about the Python-list mailing list