Quiz: What’s the Best Test Method Name?
Join the DZone community and get the full member experience.Join For Free
which of the following names of test methods do you think to be the best?
(notice that we could leave out “payment_” from the last name if it is clear from the context, i.e. from the fixture [a fancy name for test class] name.)
according to the holy book of clean code , the code should make visible the intent as much as possible. according to the testing guru kent b., a test should be telling a story to its reader – a story about how the code should be used and function. according to these two and my own experiences from reading a lot of (test) core written by other people, the last one is absolutely the best. however you have the right to disagree and discuss
ps: i firmly believe that calling a test method “
” should be punishable.
Opinions expressed by DZone contributors are their own.