A stub is a controllable fake application or component that temporarily replaces a real dependency. It lets you investigate interactions without relying on the dependency’s normal behavior. section 1.2.1
Use a stub when the source of an unexpected interaction is difficult to locate:
- Replace the component receiving the wrong request with a stub. section 1.2.1
- Make the stub block the request so the application waits indefinitely. section 1.2.1
- Use a profiler to identify the application code stuck waiting for the stub. section 1.2.1
- After correcting the problem, use the stub again to test the solution. section 1.2.1
Finding the source of an erroneous request
An application sends a request to the wrong system component. When the real recipient is replaced by a stub that never responds, the application remains blocked. Profiling the blocked execution reveals which code issued the request, giving the investigation a starting point before using a debugger. section 1.2.1 section 2.3
Figure 1.8 You can replace the system component your app calls with a stub. You control the stub to determine where your app sends the request from quickly. You can also use the stub to test your solution after you correct the problem.
Shows how replacing a called system component with a controlled stub supports both investigation and verification. section 1.2.1









