Art of Unit Testing

phil hunt zen19725 at zen.co.uk
Wed Aug 3 14:29:54 CEST 2005


On Tue, 02 Aug 2005 19:02:09 +0200, Björn Lindström <bkhl at stp.lingfil.uu.se> wrote:
>Christoph Zwerschke <zwerschke at zuv.uni-heidelberg.de> writes:
>
>> Would it make sense to add "globaleSetup" and "globalTearDown" methods
>> to the TestCase class? I think at least it would not harm
>> anybody. Where should such proposals be submitted?
>
>In general that's not such a good idea. If you build your tests like
>that, it gets hard to know which test really went wrong,

No it isn't, provided you've coded your setup code and tests well.

And if you haven't coded your setup code and tests well, you're 
fucked anyway.

Programming languages and libraries should assume the programmers is 
competent and knows what he's doing. People who disagree should 
stick to Java or Pascal or something.

> and you might
>get the situation where the whole set of tests works, but depend on each
>other in some way. (This can also happen for more obscure reasons, and
>is worth looking out for whichever way you do it.)

Sure. And if the programmer is competent, he'll bear that in mind 
when he's writing the tests.

>So, rebuilding the environment for the each before every single test is
>generally worth the overhead.

Note "generally". Sometimes it isn't.

-- 
Email: zen19725 at zen dot co dot uk





More information about the Python-list mailing list