Final Remarks on Testing External Services
Understand different methods for testing external services in Elixir applications, such as making real HTTP requests, building test servers, and using ExVCR for request replay. Learn how to handle dependencies, tag tests requiring internet, and approaches for non-HTTP service testing.
We'll cover the following...
We'll cover the following...
Which approach is best for testing external services?
We saw three possible approaches to testing third-party HTTP services:
- Making real requests
- Running a test server that mocks the service
- Recording real requests and replaying them
As is often the case in our industry, there’s no definitive best approach among these. Each one fits some use cases better.
Test server
Building a test server is the way to go if we want tight control over how the third-party API should behave. This ...