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.


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.

  • 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 5:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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