O'Reilly logo

Mastering Software Testing with JUnit 5 by Boni García

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Code smells

Code smells (also known as bad smell when referred to software) are undesirable symptoms within the source code. Code smells are not problematic per se, but they can evidence some kind of issue nearby.

As described in previous sections, tests should be simple and easy to read. With that promises, code smells should be present in our tests under no circumstances. All in all, generic code smells might be avoided in our tests. Some of the most common code smells are the following:

  • Duplicated code: Cloned code is always a bad idea in software, since it breaks the principle Don’t Repeat Yourself (DRY). This problem is even worst in tests, since test logic must be crystal clear.
  • High complexity: Too many branches or loops may be potentially ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required