DEV Community

Discussion on: What's your take on writing tests for third-party services or integrations?

Collapse
 
jdforsythe profile image
Jeremy Forsythe

The prevailing wisdom here is to record actual responses from the third party and use them to mock responses in your integration tests. You shouldn't be testing third party APIs in your integration tests.

You may want to separately ping the API with monitoring software to ensure it's up, but the wisdom is you trust the third party to act the way it says. If you can't trust them, you should have vetted the service better before choosing it.

Collapse
 
david_ojeda profile image
David Ojeda

Thanks for the advice! We already ping the service, but I thought it would be a good idea to also test the specific endpoint responses themselves.

I'll change the tests to mock the response instead and see how it goes