7

Quiz: What's the Best Test Method Name?

 2 years ago
source link: https://blog.jakubholy.net/2011/12/13/quiz-whats-the-best-test-method-name/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Quiz: What's the Best Test Method Name?

December 13, 2011
Which of the following names of test methods do you think to be the best?

[polldaddy poll=5757187]

(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 "test()" should be punishable.

Are you benefitting from my writing? Consider buying me a coffee or supporting my work via GitHub Sponsors. Thank you! You can also book me for a mentoring / pair-programming session via Codementor or (cheaper) email.

Allow me to write to you!

Let's get in touch! I will occasionally send you a short email with a few links to interesting stuff I found and with summaries of my new blog posts. Max 1-2 emails per month. I read and answer to all replies.

Copyright © 2022 Jakub Holý
Powered by Cryogen
Theme by KingMob

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK