mardi 21 juillet 2020

What are good patterns to describe your class and test methods using @DisplayName?

I've started to use the @DisplayName annotation from Jupiter API (Junit 5) to describe what's in going on my tests. This feature is very usefull to help other developers to better understand what the tests are intended to do (because your texts can contain spaces, special characters, and even emojis). For now, I'm using the following strategy to create my descriptions:

  • Class level: "Check [the general feature being tested]"
  • Method level: "When [condition to be meet]"

However, I'm wondering if there are betters ways to describe the tests. So my question is, what are the good patterns to be followed when using @DisplayName annotation to improve my tests descriptions? I'm looking for things like:

  • Keywords that help to categorize tests by their testing objectives
  • Emojis to indicate features, importance, etc...

Aucun commentaire:

Enregistrer un commentaire