Test Spy

Noun · Development

Definitions

  1. A test double that wraps a real implementation, allowing the actual behavior to execute while silently recording calls, arguments, return values, and exceptions so assertions can be made after the fact.

    In plain English: A wrapper around real code that secretly records how it was used, so you can check later without changing the code's behavior.

    Example: "I used a spy on the logger so the real logging still happens but I can assert we logged the error exactly once."

Related Terms