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

Greg Ewing (using news.cis.dfn.de) ckea25d02 at sneakemail.com
Mon May 5 19:45:20 EDT 2003


Roy Smith wrote:
> 
> A unit test is something which tests an atomic unit of code for correct 
> operation.  This is opposed to system testing, where you test a whole 
> application at one time.  Not everybody agrees on what an "atomic unit" 
> is.  Some people think of a function as a unit, some people think of a 
> class as a unit.  I don't think there's any one correct answer to that.

I think the important thing about what we're discussing
here is that the tests are automated, not whether they're
testing identifiable code units or not.

My test suite for Pyrex runs the whole compiler for each
test, because the parts are so interdependent that it
doesn't really make sense to test any part in isolation --
all the interesting things happen in the way the various
parts interact.

What I do have is a bunch of tiny Pyrex source files
that each exercise some part of the Pyrex language. So the
"units" being tested are pieces of functionality rather
than pieces of code. Maybe it doesn't strictly qualify
as unit testing, but it seems to work!

-- 
Greg Ewing, Computer Science Dept,
University of Canterbury,	
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg





More information about the Python-list mailing list