Legendary Trio
automationthoughts

Testing approaches for integrations

Testing integrations with external APIs is harder than testing regular business logic. The external API isn't available in CI, has side effects, and may behave unpredictably.

Our approach: a clear separation between "code responsible for logic" and "code responsible for HTTP calls." Logic is tested with mocked HTTP clients. Separately — integration tests that run manually or in a dedicated environment.

Another thing that helps: recording real API responses and using them as fixtures. This lets you test handling of real data formats without standing up a real integration.

Not perfect, but it works.