Skip to content

Ask HN: How do you run integration tests involving third party HTTP services?

1 pointlabarilem1 comment
On HN

Some approaches that come to mind:

- Convert the integration test to a "tighter" unit test which completely mocks the external service, thus effectively not firing any HTTP request

- Run a proxy/mock server intercepting all requests that responds with mock data, thus accepting and responding to HTTP requests. An example: https://mock-server.com

Most third party APIs do not provide a sandbox or a dry-run mode so this is a recurring topic.

I'm using Node.js so if you know of any node-specific tool, it'd be great!

Comments

For my own tools i use python-responses for mocking the api responses and i have an seperate tool to check if my api calls still work.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.