DEV Community

Discussion on: External Service testing in Phoenix

Collapse
 
rhymes profile image
rhymes

I do mock errors sometimes or I just call the server with invalid data and register the possible error messages.

Some APIs have different error messages for different cases and for me it's faster to record them than to actually figure out how to mock all of them.

My issue with API mocks is that they can be difficult to maintain updated, it's not this case because S3 is not going to change at all but for APIs where there's no client, just the documentation, I am way faster if I record it once instead of using mocks.

To be able to mock those, you still need to wire up Postman, hit them once, check the response, mock such response, so why not do that using VCR?

Thread Thread
 
vinhnglx profile image
Vincent Nguyen

I understand and agree with you. But I don't want to use VCR because there are many ways to do the external testing. VCR is just an approach.

About the reason: after reading the thoughtbot post and personally I want to keep my code is simple. That's all.

Btw I can use Postman to get the response from external services and update for my mock modules.

Thread Thread
 
rhymes profile image
rhymes

Btw I can use Postman to get the response from external services and update for my mock modules.

that is absolutely true :-)

Thanks for the discussion!