6.5. Lowered expectations

Programmers tend to be detail-oriented. We also tend to be lazy and often look for the easiest way of doing things. That’s good—a lot of the time the easiest thing is what we should do—but sometimes we can overdo it and we end up shooting ourselves in the foot along the way.

This test smell is called lowered expectations because it’s a case of seeing an easy way out and taking it at the cost of lowered standard of certainty and precision. Taking a shortcut like that can often help you move faster, giving enough certainty that the piece of code you just added does in fact make a difference in the program’s output or behavior. In the long run, such tests can maintain a false sense of security precisely because of their ...

Get Effective Unit Testing 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.