Naming convention JUnit suffix or prefix Test [closed]

Another argument for suffix – at least in english language:

A class usually represents a noun, it is a model of a concept. An instance of one of your tests would be a ‘MyClass test’. In contrast, a method would model some kind of action, like ‘test [the] calculate [method]’.

Because of this, I’d always use the ‘suffix’ for test classes and the prefix for test methods:

the MyClass test          --> MyClassTest
test the calculate method --> testCalculate()

Leave a Comment