Speed and reliability are key elements of a robust test suite. But for a test suite to be fast and reliable, you need to be in control of the environment in which the test suite is run. You don't want to write a unit test that depends on the response of an API request. Right? For such a unit test to be fast and reliable, the API your application interacts with needs to be mocked and its response stubbed.
Remember from the previous installment of this series that our goal is to mock the Core Location framework and stub the responses of any geocoding requests we send to Apple's location services. This is necessary if we want to create a fast and reliable test suite. Being in control of the test environment is key if your goal is creating a robust test suite.
This is the third and last installment of a series that teaches you how to mock and stub system classes in Swift. In this tutorial, we unit test the AddLocationViewViewModel class.