Summary
In this chapter, we have learned how to write tests for calls to CLGeoCoder
and how to test the async/await REST API calls of URLSession
. We have seen what we need to do in the test method to test whether an error is thrown in an async/await call. In addition, we have learned how to make our network code tests independent from the implementation of server infrastructure. This way we made our tests fast and robust.
You can use the skills gained in this chapter to write tests for the complete network layer of your apps. But you don't have to stop there. The strategies we've covered in this chapter also help to write tests for all kinds of async/await APIs.
In the next chapter, we will put all the code that we wrote up to now together, and finally see the app running on the simulator.