Mocking Vs. Patching (A Quick Guide For Beginners)
As a software developer it’s not uncommon that your code depends on external systems, databases, or APIs.
So how do you write tests for code that’s heavily reliant on these systems, totally out of your control?
Perhaps you’ve heard of mocking, patching or even stubbing and have little to no idea what it means or how to use it.
Should you write mocks, or patches? What’s the difference between them? Which one should you use?
This can be quite confusing, especially if you’re new to testing.