Art of Unit Testing

phil hunt zen19725 at zen.co.uk
Wed Aug 3 07:42:50 EDT 2005


On Tue, 02 Aug 2005 18:44:01 +0200, Christoph Zwerschke <zwerschke at zuv.uni-heidelberg.de> wrote:
>In August 2001, there was a thread about the "Art of Unit Testing":
>http://groups.google.com/group/comp.lang.python/browse_frm/thread/aa2bd17e7f995d05/71a29faf0a0485d5
>
>Paul Moore asked the legitimate question why there is no hook for a 
>"global" fixture code that is run only once for the whole TestCase, as 
>opposed to the normal "setUp" and "tearDown" code that is run for every 
>single test in the TestCase. A "global fixture" would be preferable 
>whenever creating the fixture is time consuming, e.g. you have to create 
>a database connection or even a whole database.
>
>What would be the preferred solution for such global fixtures? Simply 
>create the database, run the TestCase, and drop the database?
>
>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?

I think this cowuld be very useful. As to the name, do other xUnit 
testing frameworks have a common name? If not, may I suggest 
setupAll() and tearDownAll(). 


-- 
Email: zen19725 at zen dot co dot uk





More information about the Python-list mailing list