Quick tips & tricks. BDD test naming macro.

This time it’s about useful macro that speeds up writing test names. Although we’re not using yet BDD development style (BDD is for Behavior Driven Design) I like to give to my test BDD-style names. You know, something like

[Test]
public void When_user_pressed_OK_message_should_be_prepared_and_sent()
{
}

Writing down these names, when words are separated by underscores is not easy and error prone.

Fortunately, Jean-Paul S. Boodhoo has posted in his blog an updated macro for formatting test names in BDD-style manner:

Using this macro you can write test name as an usual sentence, having words separated by spaces. After running the macro it will replace all space characters by underscores.

For me it was first macro written for Visual Studio, but after some rambling within VS I have the macro running and working well. Thereafter, found these links than can help to setup and use VS macros:

Advertisement
  1. Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

Gravatar
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 )

Connecting to %s

Follow

Get every new post delivered to your Inbox.