Skip to content
Latchkey

Stub - CI/CD Glossary Definition

A stub is a test double that returns canned, predetermined responses so the code under test has predictable inputs.

A stub is a test double that returns predetermined responses to calls made during a test, with no logic of its own. It supplies inputs to the code under test but does not assert on how it was used.

Stubs are used when a test needs a dependency to return a specific value (an HTTP 200, an empty list) without invoking real behavior.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →