Test Hook

Noun · Development

Definitions

  1. A lifecycle callback — such as beforeEach, afterAll, setUp, or tearDown — provided by a test framework that runs code at specific points before or after tests execute, used to initialize fixtures, reset state, connect to services, or clean up resources.

    In plain English: A function that runs automatically before or after your tests to set things up or clean things up.

    Example: "The beforeEach test hook truncates all database tables so every test starts with a clean slate."

Related Terms