In this episode of Testing All The Things we refactor the test code we created in episodes 027 – 030. Replacing the hand coded test doubles with ones we create using the Go mocking framework in Testify.
The code produced during this episode can be found on GitHub
This episode of Testing All The Things we continue a series where we look at different forms of Test Doubles. We will look at a different type of Test Double in each of the videos. We will implement our own test doubles, we will not use a mocking framework.
We use Test Doubles to replace the dependencies a class uses in production so we have complete control over its dependencies enabling us to isolate the code under test from the implementation of its dependencies.
In the video we look at the Mock type of Test Double.
The code produced during the Test Doubles episodes can be found on GitHub
In Episode 4 of Testing All The Things we continue to create the driving licence generator we started in the previous two videos. In this video we create a mock random number generator to create random digits to the end of the driving licence number.
You can find all the Test Double code in this GitHub repository or just the code created for the spy functionality in this commit