Stubbing Dependencies

We already met a first stub in the test doubles intro. Here we look at using a mocking framework and follow up with another exercise that needs a stub.

Connect - Mocking frameworks

What mocking frameworks have you used? Which one(s) do you use in your current codebase? Do a Web Hunt and look for resources and documentation for your preferred mocking framework. Can you use it to create a Stub?

Concept - Stub with a mocking framework

Recap when you might want to use a stub - to replace an awkward dependency. Demo how to create a stub in their preferred mocking framework.


Do Tire Pressure again, this time using the mocking framework.

If they finish this task quickly, ask them to work on Turn Ticket.


List some benefits from using a mocking framework over hand-coding your stubs. Are there any disadvantages to using the mocking framework?