Write Tests That Read Like a Story
I spent a chunk of this week buried in test code across my repos, and it reminded me of a chapter from Software Engineering at Google that I keep coming back to. The chapter is about test clarity, and the core idea is simple: a good test should read like a story, not like a method call. Name the behavior, not the method The easiest win is in the name. A method-oriented test is called testUpdateBalance. A behavior-driven test is called shouldNotAllowWithdrawalsWhenBalanceIsEmpty. Read that second one out loud with the class name and it becomes a sentence: “BankAccount should not allow withdrawals when balance is empty.” ...