How good are your Unit Tests?
Do you actually know how to measure how good or how bad your unit tests are? It can be subjective sometimes, can't it? 🤔
One can say their tests are good because they cover all the lines of code as well as all the methods in the class. However, assessing the quality of a unit test is not only about how much it covers, there are other elements involved.
I believe writing unit tests is like writing any other code, each person will do it differently, apply their personal preference in terms of how they organise it, how they describe the scenarios, etc. So, it is a subjective matter.
BUT there are some good practices we all can follow to make our tests better. I've summarised a few items I always try to keep in mind when I'm writing my own unit tests.