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.

1 Answer 1

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.

3
  • 10
    Likewise, teardown is a noun and tear down is a verb, so tearDown is also correct for a method name.
    – David Arno
    Commented Jun 12, 2019 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
    Commented Jun 12, 2019 at 18:02
  • You have a sweet JUnit setup set up! I love your setUp, hate to see that get torndown.
    – Kayaman
    Commented Jun 13, 2019 at 5:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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