re: Don't Mock What You Don't Own VIEW POST


just wondering, how do you design, and test the handling of errors and failures from 3rd party code without mocking the responses, because breaking e.g S3 for real is not really an option.

You can use dev instance, and for S3 there is actually a whole fake server :-)

But when you work with external libraries/services – you better work with real thing, because mocking it will hide real problems from you.

And if you have a nice wrapper around S3 lib – you won't have to test error handling every time you have to interact with this service. You'll have a set of tests that check if S3 still has the same interface and interacts with you in expected manner.

code of conduct - report abuse