A well-named test answers 3 questions: 1


A well-named test answers 3 questions:

1. What code is being tested?
2. What scenario is being tested?
3. What is the expected result?

Answering these 3 questions document’s the programmer’s intent.

Result? The test reads like documentation. 👍

This tweet is inspired by a test I just found simply called “backspace”. 🤦‍♂️

My thought: What should I expect to happen regarding a backspace?!

I shouldn't have to read the entire test to try and guess what it's testing.

Clear test names save time and document intent.

View original on X