How to organize test cases with PyUnit

Peter Hansen peter at engcorp.com
Mon Jul 8 19:36:27 EDT 2002


Roy Smith wrote:
> 
> Peter Hansen <peter at engcorp.com> wrote:
> > Is it really important the order the tests are run in?
> 
> I'm not sure, but it certainly *feels* like it should be important ;-)
[...]
> From the point of view of "it's done when it passes all the tests", then
> yes, I agree with you that the order doesn't matter.  But as a
> diagnostic tool, it seems like order might be important.

That makes a lot of sense.  In that case, maybe it would be enough
to organize the tests into reasonably small test cases, at which point
you mostly wouldn't have to be concerned with which one actually ran
first. 

I tend to start with a test case called something like BasicTests,
and certainly if there's a failure there, I can disregard the other
more sophisticated test cases that sort of build on that one.  Within
it I might have only four or five tests, so I don't much mind if one
runs before the other.  I do, however, as I said, sometimes do the
same as you with the numbering, but I don't generally worry about
keeping room for expansion.  It's easy enough to renumber five tests
if I really, really need to insert a new test01.

-Peter



More information about the Python-list mailing list