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.
should replace children when updating instance
replaces children when updating instances
should apply discount when total cost exceeds 100 dollars
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.