Fixtures 🔗

Manage testing resources.

Macros 🔗

#define RUNNER_SETUP(
)

Statements to execute when the runner initializes.

)

Statements to execute before the runner terminates.

#define SUITE_SETUP(
SUITE_NAME)

Statements to execute prior to the test suite.

SUITE_NAME)

Statements to execute after the test suite.

#define TEST_SETUP(
SUITE_NAME)

Statements to execute before each test of the test suite.

#define TEST_TEARDOWN(
SUITE_NAME)

Statements to execute after each test of the test suite.

Discussion 🔗

Fixtures ensure that tests execute in a consistent environment and that test-specific resources are cleaned up or reset afterward. Audition provides two flavors of test fixtures:

  • Setup: Code that runs before a test or suite to create the necessary environment (e.g., creating database entries, initializing objects).
  • Teardown: Code that runs after a test or suite to clean up or reset the environment (e.g., deleting test data).

To learn more about fixtures, see Writing Fixtures.