Art of Unit Testing



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?

-- Christoph Zwerschke
.



Relevant Pages

  • Re: Art of Unit Testing
    ... >single test in the TestCase. ... A "global fixture" would be preferable ... >a database connection or even a whole database. ... zen19725 at zen dot co dot uk ...
    (comp.lang.python)
  • Database Design
    ... Could someone please help shed a little light on a database query I ... Player Status ... that in creating a fixture I am having problems ... In relational terms I can't see how to pull two teams from the team ...
    (comp.databases.ms-access)
  • Re: [PATCH 0 of 9] x86/smp function calls: convert x86 tlb flushes to use function calls [POST 2]
    ... database that uses a lot of mmap/munmap and those calls have slowed ... I'm not sure if I can send the testcase I have. ... shouldnt be too hard to reproduce even with a vastly simplified ...
    (Linux-Kernel)