Setup Teardown

Phrase · Development

Definitions

  1. The paired lifecycle hooks in test frameworks (e.g., `beforeEach`/`afterEach`, `setUp`/`tearDown`) that run code before and after each test case to establish preconditions (database seeding, mock registration) and clean up resources (rollback transactions, restore stubs).

    In plain English: Code that prepares the environment before each test and cleans it up afterward, so every test starts with a fresh slate.

    Example: "The teardown wasn't rolling back the transaction, so test order determined whether the suite passed — classic setup/teardown leak."

Related Terms