Testing the Actual Interaction with Services

Learn different approaches of how to test the application code that talks to the actual API.

When working with third-party APIs like the weather API, we push the code that integrates with the API outside our application in a lightweight wrapper. When we’re testing our application, we’re able to swap out that small part with a double to run the rest of our application. However, we also need to make sure that the code that interacts with the API works. We’ll need a test for that.

In our weather API application, the code that interacts with the weather API is this:

Get hands-on with 1400+ tech skills courses.