Open Mic

images/mocking/server.png

Yes! You are absolutely right. By hard-coding the server response into the stub itself, we have now introduced another form of coupling between the server and the unit tests. If the server response changes, we need to update our unit tests accordingly. Coupling isn’t just for objects. We can have coupling between systems and data too.

Here is a table summarizing the main differences between these two approaches, which Martin Fowler refers to as the Classicist vs. Mockist approach to unit testing.[17]

images/mocking/vs.png

No. Not at all. Mocking and dependency ...

Get The Way of the Web Tester now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.