O'Reilly logo

Effective Unit Testing: A guide for Java Developers by Lasse Koskela

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

Chapter 4. Readability

 

In this chapter
  • Test smells around assertions
  • Test smells around information scatter within the code base
  • Test smells around excess or irrelevant detail

 

Tests are the programmer’s way of expressing and validating assumptions and intended behavior of the code. Reading the tests for a given mass of code should provide the programmer with an understanding of what the code should do. Running those tests should tell the programmer what the code actually does.

Assertions play a key role in deciphering the behavior of code. Though all of the code that makes up a test tells a story about how the code under test is expected to behave, it’s the assertion statements that contribute the punchlines. It ...

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