Take the 2-minute tour ×
Code Review Stack Exchange is a question and answer site for peer programmer code reviews. It's 100% free, no registration required.

Can't make up my mind. For a class Foo, should its test class be called FooTest or FooTests?

share|improve this question

closed as off topic by Michael K Oct 25 '11 at 16:39

Questions on Code Review Stack Exchange are expected to relate to code review request within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

2  
This is off topic here, as well as being not constructive because of its subjectivity. Code Review is for reviewing code, not naming conventions. –  Michael K Oct 25 '11 at 16:45

2 Answers 2

I would call it FooTests because it is not a test in itself but a class for tests. Ideal name would be fixture but nobody uses it .

While were are at it make sure to name your methods [MethodName_StateUnderTest_ExpectedBehavior]

Source : http://www.osherove.com/blog/2005/4/3/naming-standards-for-unit-tests.html

share|improve this answer
    
Yeah, I've been leaning towards that as well. The naming convention you point at, I already use ;) –  Svish Oct 25 '11 at 13:28

I'd call it FooTest because Maven Surefire Plugin use these default include patterns:

 <include>**/Test*.java</include>
 <include>**/*Test.java</include>
 <include>**/*TestCase.java</include>

So I don't have to modify the include patterns because it wouldn't recognize FooTests with the default settings.

Another alternative is TestFoo which is used by xUnit Patterns website and the book.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.