Next: , Previous: Test files, Up: Unit testing


8.2.3 Test suite files

Once you add a new test file, that defines a testcase for some module function, you need to integrate it into the test suite that defines the module itself.

Each module directory (such as torture/unit/base/stm) has a test suite definition file such as tsuite-stm.c. The suite definition file defines a function called tsuite_MODULE-NAME that return a Suite * object.

New test cases are added using the suite_add_tcase function:

extern TCase *my_new_tcase (void);

Suite *
tsuite_mymodule ()
{
  Suite *s;
  ...

  suite_add_tcase (s, my_new_tcase ());
  ...

  return s;
}