Stub - CI/CD Glossary Definition
A stub is a test double that returns predefined responses to calls made during a test, with no logic of its own, so the code under test gets controlled inputs.
Typical use
You stub a slow or external call (an HTTP client returning fixed JSON) so the test runs fast and deterministically and exercises a specific code path, like the error branch.
Stub vs mock
A stub provides answers but makes no assertions; a mock provides answers and verifies it was called as expected. Choose a stub when you care about output, a mock when you care about the interaction.
Related guides
Mock - CI/CD Glossary DefinitionMock: A mock is a test double pre-programmed with expectations about how it should be called, that fails the…
Test Double - CI/CD Glossary DefinitionTest Double: A test double is any stand-in object used in place of a real dependency during testing. Mocks, s…
Property-Based Test - CI/CD Glossary DefinitionProperty-Based Test: A property-based test checks that a property holds for many automatically generated inpu…