Victor Engmark thinks we should start test names with âshouldâ for a handful of reasons, hereâs a few:
- It removes redundancy, because the function name should already be in the call stack.
- It is falsifiable, a person reviewing the test can decide to which degree the name agrees with the actual test.
- It encourages testing one property of the function per test
I donât disagree, but I like to take it a step further: Let the âshouldâ be implied by the rest of the test name.
Instead of: should replace children when updating instance
I prefer: replaces children when updating instances
Instead of: should apply discount when total cost exceeds 100 dollars
I prefer: applies discount when total cost exceeds 100 dollars
Most of Victorâs reasons for using âshouldâ still apply with this format, but itâs less verbose and more accurately describes the software working as expected when the tests pass.