Previous: Exporting the plugin dictionary, Up: The ARTE Plugins


6.4 Exporting the setup and teardown functions

In addition to the ‘PLUGIN Dictionary’, the Plugin must export an additional structure with Setup and Teardown functions:

     
     /** Setup & Teardown functions exported by the ARTE Plugin
      *   into the ARTE Core */
     typedef struct
     {
       /** Setup test */
       void (* setup_func) (void);
       /** Teardown test */
       void (* teardown_func) (void);
       /** Setup suite */
       void (* suite_setup_func) (void);
       /** Teardown suite */
       void (* suite_teardown_func) (void);
     } arte_setup_functions_t;
     

These functions allow preparing and controlling the context of each test or suite of tests.

setup_func
The ‘setup_func’ will be executed just before starting to load a new test, even before creating the customized TCL interpreter.
teardown_func
The ‘teardown_func’ will be executed just after the test stopped its execution (both if passed or failed).
suite_setup_func
The ‘suite_setup_func’ will be executed once before any test of the given suite.
suite_teardown_func
The ‘suite_teardown_func’ will be executed once after all the tests of the given suite have been run.

In order to export the Setup and Teardown functions to the Arte Core, the Plugin must implement the following function in its API:

     
     /** Function to retrieve the array with the module setup and
      *   teardown functions */
     arte_setup_functions_t *
     arte_plugin_get_setup_functions(void);