Naming unit tests


#1

Tests should have names that describe a business feature or behavior. When naming tests, avoid:

  • Using technical names for tests (Example: myMethodNameReturnsSomething)
  • Leaking implementation details in test names (Example: myTestReturnsFalse or CommandPatternTest)

If your test names express business behaviors, when you change the technical implementation or refactor code, your test names should remain unchanged.