Snapshot Testing

Noun · Development

Definitions

  1. A testing technique that captures the output of a component or function and compares it against a stored reference ('snapshot'). If the output changes unexpectedly, the test fails. Useful for catching unintended UI changes but can lead to brittle tests if snapshots are updated without review.

    In plain English: Testing by taking a 'photo' of your code's output and comparing it to a saved version to catch unexpected changes.

    Example: "The snapshot test failed because you changed the button text — update the snapshot if the change is intentional."

Related Terms