What We’ve Learned So Far

Wow. That was a tricky chapter. We got into some pretty deep stuff there, and if all of that doesn’t make a lot of sense, don’t worry. It only took me ten years to wrap my head around some of these ideas, and if you understood half of what we covered here, you are way ahead of me when I was in your shoes.

But here are a few key takeaways for the chapter:

  • Unit tests don’t have to be mocks. You can (and should) prefer to work with real objects instead.

  • By limiting your unit tests to the public APIs of your objects, and by testing your objects from the outside in, you can reduce coupling, making your objects more open to design, and easier to change.

  • Mocks are a handy tool, but try not to overuse them. They are great for ...

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.