Stub

Noun · Development

Definitions

  1. A minimal, hard-coded stand-in for a real dependency that returns predetermined data when called, used in testing to isolate the unit under test from external systems like databases or APIs. Unlike mocks, stubs typically do not verify how they were called.

    In plain English: A fake version of a real service used during testing that always gives back the same canned answer.

    Example: "The test stubs the payment gateway to always return 'approved' so we can focus on testing the order logic, not Stripe."

Related Terms