6.4. Isolation framework design antipatterns

Here are some of the antipatterns found in frameworks today that we can easily alleviate:

  • Concept confusion
  • Record and replay
  • Sticky behavior
  • Complex syntax

In this section, we’ll take a look at each of them.

6.4.1. Concept confusion

Concept confusion is something I like to refer to as mock overdose. I’d prefer a framework that doesn’t use the word mock for everything.

You have to know how many mocks and stubs there are in a test, because more than a single mock in a test is usually a problem. When it doesn’t distinguish between the two, the framework could tell you that something is a mock when in fact it’s used as a stub. It takes you longer to understand whether this is a real problem or not, ...

Get The Art of Unit Testing, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.