6 Small Unit Testing Tips
Henrik Warne
DECEMBER 27, 2020
Choosing test values when writing unit tests is mostly guided by the need to cover all cases of the program logic. However, some values are better than others. Here are a few tips on how to pick values that make mistakes easy to spot and the tests easy to read. Plus a bonus tip on a quick way to double check your tests. . 1. Make mistakes obvious. Suppose you have a function that subtracts one number from another, then using 20 – 10 = 10 is not so great.
Let's personalize your content