Introduction to Stubbing

Get familiar with the concept of stubbing in automated testing.

In unit testing, stubbing refers to a technique used to isolate the code being tested by replacing certain parts with simplified implementations, often called stubs. Stubs are essentially placeholder functions or objects that mimic the behavior of the real components, but they’re designed to return predefined values or perform predefined actions. The purpose of stubbing is to control the behavior of external dependencies or collaborators during unit testing, ensuring that the test focuses only on the specific unit of code being tested.

Stubbing and mocking are related concepts used in automated ...