HACKER Q&A
📣 labarilem

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


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!


  👤 stop50 Accepted Answer ✓
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.