0

Reference:

http://junit.sourceforge.net/junit3.8.1/javadoc/junit/framework/TestCase.html#setUp()

setUp should have ideally be named as setup

I've explored if any duplicate method setup is used in its parent hierarchy, because of which they renamed the method to setUp, but couldn't find any.

Kilian Foth
  • 107,706
  • 45
  • 295
  • 310
kai
  • 245
  • 1
  • 7

1 Answers1

28

No, it shouldn't.

For the moment, there is still a difference between the noun "setup" and the verb "set up":

Hey Joe, can you set up the amp for me?

Dude, that's a sweet stereo setup you've got there!

Since procedure names are conceptually verbs, setUp is the correct way to spell the method name. I'm aware that this is slowly changing so that both will eventually come to be spelt as one word, but as long as we have the difference, it's a good idea to exploit that difference to increase clarity.

Kilian Foth
  • 107,706
  • 45
  • 295
  • 310
  • 10
    Likewise, *teardown* is a noun and *tear down* is a verb, so `tearDown` is also correct for a method name. – David Arno Jun 12 '19 at 10:52
  • 4
    "I'm aware that this is slowly changing" I don't agree; the use of single-word "setup", "login", etc as verbs is simply a flagrant grammar error, which manifests immediately when the verb is conjugated: *sets up*, *setting up*, *logged in*. Nobody tries to write "setsup". – Boann Jun 12 '19 at 18:02
  • You have a sweet JUnit setup set up! I love your `setUp`, hate to see that get torndown. – Kayaman Jun 13 '19 at 05:23