Art of Unit Testing

phil hunt zen19725 at
Wed Aug 3 14:25:36 CEST 2005

On Tue, 02 Aug 2005 21:11:52 +0200, Christoph Zwerschke <cito at> wrote:
>Thanks for the link, Grig. I wasn't aware of the py lib so far. The 
>possibility to create fixtures at the three different scopes is exactly 
>what I was looking for.
>Anyway, I think it would be nice to have that feature in the standard 
>lib unittest as well. It should not be too hard to add setUpOnce and 
>tearDownOnce methods in addition to setUp and tearDown. Actually, I am 
>wondering that there doesn't seem to be any development progress since 
>unittest was included in the standard lib of Python 2.1 in August 2001. 
>I had expected that such an important module would be continually 
>improved and maintained. How come? So few people using unit tests? Or do 
>most people write their own testing code or use py.test?

I can answer this question, at least for myself.

I use regression testing a lot, and have done so since before 
Python's unittest was written.

Originally I just used my own code, which didn't use classes just 
functions that called other functions. later on I decided to have a 
look at unittest. I found two problems with it. 

Firstly it didn't 
stop when it reached an error, it continued doing the rewsr of the 
tests. This wasn't what i wanted: most of the time when a test 
fails, I want to look at what's happening. I don't want unnecessary 
information about other tests, I want to concentrate on that one 

Also, the log of information sent to stdout about each test was less 
informative than I wanted (and which my old system provided).

So I had a look at unittest to see if I could modify it to fix these 
problems. However, I found the code to be rather complex and hard to 
understand so I decided it would be quicker to write my own testing 
framework. Which I did.

Email: zen19725 at zen dot co dot uk

More information about the Python-list mailing list