Timelines

When the skeleton test is run by typing 'python testSkeleton.py', it

    1. includes file framework.py

        1.1 locates and imports the Testing package by means of
            - auto-detection

        1.2 locates and includes file ztc_common.py

            1.2.1 sets up the instance environment by means of
                - ZEO_INSTANCE_HOME environment variable
                - INSTANCE_HOME environment variable
                - auto-detection
                - optional custom_zodb.py
    
    2. imports module Testing.ZopeTestCase

        2.1 imports module Testing.ZopeTestCase.ZopeLite

            2.1.1 imports module ZODB
            2.1.2 imports module Globals
            2.1.3 patches OFS.Application to not auto-install all products
            2.1.4 patches App.ProductContext to not auto-install all help files
            2.1.5 imports module Zope
            2.1.6 starts Zope
            2.1.7 installs product PluginIndexes
            2.1.8 installs product OFSP

        2.2 imports module Testing.ZopeTestCase.ZopeTestCase

            2.2.1 creates the connection registry
            2.2.2 defines class ZopeTestCase(unittest.TestCase)

    3. installs product SomeProduct

    4. defines class TestSomeProduct(ZopeTestCase.ZopeTestCase)

    5. executes method framework()

        5.1 collects all TestCase-derived classes in a test suite
        5.2 runs the test suite using the TextTestRunner


When a ZopeTestCase test method is run, it

    1. executes setUp()

        1.1 calls the beforeSetUp() hook

            1.1.1 by default begins a new transaction
        
        1.2 opens a ZODB connection and retrieves the root application object

        1.3 sets up the default fixture
        
            1.3.1 creates a Folder object in the root
            1.3.2 creates a UserFolder object in the folder
            1.3.3 creates a default user in the user folder
            1.3.4 logs in as the default user

        1.4 calls the afterSetUp() hook

    2. executes the test method

    3. executes tearDown()

        3.1 calls the beforeTearDown() hook

        3.2 calls the beforeClose() hook

            3.2.1 by default aborts the transaction

        3.3 clears the fixture *)

            3.1.1 aborts all transactions
            3.1.2 closes all ZODB connections 
            3.1.3 logs out
            3.1.4 calls the afterClear() hook


*) Note: The fixture is also cleared if an error occurs during setUp()

