BDD: We shouldn’t use "Should"

I like behavior driven development. Even though I still using Ruby and Rails built-in testing framework, I write test names descriptive of behavior.

But I have stopped using should.

Should has become a bunch of noise in BDD that needs to be expunged. What’s wrong with test_should_move_resource_lower_and_return_to_edit_exhibit? One alone is fine, but to read a bunch of should phrases over and over is mind-numbing:

test_should_require_email_on_signup
test_should_require_password_confirmation_on_signup
test_should_require_password_on_signup
test_should_remember_me

What a lot of noise! Who wants to keep hearing the word “should” in their head over and over? Or writing it over and over? Not me!

Use the Active Verb!

So how do I write my test names? Using the active verb:

test_moves_resource_lower_and_returns_to_edit_exhibit
test_requires_email_on_signup
test_requires_password_confirmation_on_signup
test_requires_password_on_signup
test_remembers_me

Much easier to read, the ugly repetition of should is gone, and the method names are shorter. Recently, at Rails Edge in Reston, VA, Jim Weirich gave a test-first presentation where he used active verbs instead of should. I went up after and thanked him profusely.

Advertisements

0 Responses to “BDD: We shouldn’t use "Should"”



  1. Leave a Comment

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




Pages

Categories

Copyright ©2008-2013 James E Orchard-Hays, All Rights Reserved

%d bloggers like this: