"Test" word preceding Unit Test Methods

Published 10-11-2006 1:22 PM | jokiz
Previous testing frameworks including NUnit 1.0 by convention demands the Test word as prefix for test method names in order for the test runner to run it.  Now that we are using .NET attributes to instruct the runner which test methods to run, i find naming test methods with a "Test" prefix as disadvantageous because of the following reasons:

1.  It is redundant.
2.  It produces longer method names (imagine those 4 letter words that you have to type multiplied by the number of test cases in your project, wasted effort in my opinion).
3.  You have to type "Test" word for Resharper's File Structure Popup (Ctrl+F12) find member feature.

This method naming i think is a violation to the design guidelines (method names should start with action words) but i am willing to trade that because of the following disadvantages.
Filed under:

Comments

# cruizer said on October 11, 2006 4:30 PM:

to me it's not a big deal, really. as long as the test method names are descriptive enough, it doesn't matter if they start with the word "Test" or not.

# jokiz said on October 11, 2006 7:47 PM:

well as for me, if it can increase one's productivity, i'll adopt it.  for me, every second counts

# Gary said on October 20, 2006 7:45 AM:

The prefix can be helpful if you've got lots of tests in a class, along with associated helper methods - if you want to navigate to a certain test using Visual Studio's Methods dropdown, then having the Test prefix means that you can more quickly find the tests amongst other cruft methods.