Chapter 15Code Smells

Smells in This Chapter

      Obscure Test 186

      Conditional Test Logic 200

      Hard-to-Test Code 209

      Test Code Duplication 213

      Test Logic in Production 217

Obscure Test

Also known as

Long Test, Complex Test, Verbose Test

It is difficult to understand the test at a glance.

Automated tests should serve at least two purposes. First, they should act as documentation of how the system under test (SUT) should behave; we call this Tests as Documentation (see page 23). Second, they should be a self-verifying executable specification. These two goals are often contradictory because the level of detail needed for tests to be executable may make the test so verbose as to be difficult to understand.


We are ...

Get xUnit Test Patterns: Refactoring Test Code now with O’Reilly online learning.

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