The Artima Developer Community
Sponsored Link

SuiteRunner Forum
What Do You Think About setupFixture and cleanupFixture?

5 replies on 1 page. Most recent reply: Feb 14, 2003 6:51 AM by Michael Wiedmer

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 5 replies on 1 page
Bill Venners

Posts: 2284
Nickname: bv
Registered: Jan, 2002

What Do You Think About setupFixture and cleanupFixture? Posted: Feb 12, 2003 11:46 PM
Reply to this message Reply
Advertisement
Matt Gerrans and I were talking tonight about the setupFixture and cleanupFixture methods. These methods correspond to setUp and tearDown in JUnit's TestCase.

When I originally looked at TestCase, I didn't like the names setUp and tearDown, because it wasn't clear to me what was being set up and torn down. Just looking at the name, I thought that somehow the TestCase itself was being set up and torn down. That's why I added the term "Fixture" to the end of the corresponding methods in Suite. Just looking at the method name you can tell that it is fixtures being set up and cleaned up. I believe I opted for "cleanup" rather than "teardown" because it seemed more natural and a bit less violent to me.

But tonight Matt commented that he thought the method names were too long because he had to type them into an email several times. On the phone, I kept wanting to say "set up" and "tear down". It was easier to say.

One of the things I try to think about when designing is what the typical user is familiar and comfortable with. Our typical user is already familiar with JUnit, and is likely already familiar with the meaning of the methods setUp and tearDown.

So Matt and I started wondering if we should change these now while it won't affect much user code. I'm curious if anyone has code it would break. And I'm curious what people's preferred names would be. The three options I'm considering are:

1. Leave the methods as setupFixture and cleanupFixture.

2. Change the methods to setUpFixture and tearDownFixture.

3. Change the methods to setUp and tearDown.

What is your opinion?


Frank Sommers

Posts: 2642
Nickname: fsommers
Registered: Jan, 2002

Re: What Do You Think About setupFixture and cleanupFixture? Posted: Feb 13, 2003 1:07 AM
Reply to this message Reply
I agree that it'd be best to conform to JUnit's conventions as much as possible, even though it does involve changing some of my suiterunner-aware code. Should the old methods be deprecated, or just renamed? I think they should be deprecated, but having those duplicate methods in the API might really confuse people.


> I believe I opted for "cleanup" rather than "teardown"
> because it seemed more natural and a bit less violent to
> me.

To me, it sounds liberating -- "Tear down that fixture, Mr. SuiteRunner!"

But clean-up is a much better term, because that's what the method should do -- clean up after a test. I personally prefer "cleanup."

> But tonight Matt commented that he thought the method
> names were too long because he had to type them into an
> email several times.

There ought to be an IntelliJ email plug-in somewhere...


>
> 1. Leave the methods as setupFixture and
> cleanupFixture.
>
> 2. Change the methods to setUpFixture and
> tearDownFixture.
>
> 3. Change the methods to setUp and
> tearDown.
>
> What is your opinion?

#3

Bill Venners

Posts: 2284
Nickname: bv
Registered: Jan, 2002

Re: What Do You Think About setupFixture and cleanupFixture? Posted: Feb 13, 2003 8:12 AM
Reply to this message Reply
> I agree that it'd be best to conform to JUnit's
> conventions as much as possible, even though it does
> involve changing some of my suiterunner-aware code. Should
> the old methods be deprecated, or just renamed? I think
> they should be deprecated, but having those duplicate
> methods in the API might really confuse people.
>
I will either change the method names or leave them the same. At this point, I believe it is too early to deprecate. We released the software two weeks ago and according to SourceForge.net, we've had 1081 downloads. I suspect most of those people may have tried it and not used it further. Most of the people who have used it have likely used it to run their JUnit tests, not write their own Suites. Those few who have written Suites probably haven't written many, and many of those Suites will not actually have used setupFixture and cleanupFixture.

Once we release this 1.0, I will not break any code in subsequent releases, but up until 1.0, I want to reserve the right to break code. One reason we released when we did was to get feedback from the public as on the API. I want to be able to use that feedback to improve the API right up to the 1.0 release. (I also want to release it 1.0 as soon as possible, so it won't be a long wait.)

>
> > I believe I opted for "cleanup" rather than "teardown"
> > because it seemed more natural and a bit less violent
> to
> > me.
>
> To me, it sounds liberating -- "Tear down that fixture,
> Mr. SuiteRunner!"
>
> But clean-up is a much better term, because that's what
> the method should do -- clean up after a test. I
> personally prefer "cleanup."
>
Yes. In this case, though, I think it would be better to use tearDown because that is consistent with what all JUnit users are used to.

> > But tonight Matt commented that he thought the method
> > names were too long because he had to type them into an
> > email several times.
>
> There ought to be an IntelliJ email plug-in somewhere...
>
Actually, most Java programmers probably don't type all characters of method names anymore anyway. Their IDE's complete it for them.

>
> >
> > 1. Leave the methods as setupFixture and
> > cleanupFixture.
> >
> > 2. Change the methods to setUpFixture and
> > tearDownFixture.
> >
> > 3. Change the methods to setUp and
> > tearDown.
> >
> > What is your opinion?
>
> #3
This morning I'm leaning towards number 2.

I realized yesterday that there was another problem with setupFixture and cleanupFixture: I am either stretching the English language by transforming "setup" and "cleanup" into verbs or not using studly caps/camel case appropriately. I believe "setup" is a noun in English, but the verb would be "set up". That means the method name should really be: setUpFixture, not setupFixture.

I still have the same problem I originally had with JUnit's names setUp and tearDown. mySuite.setUp() tells me you are setting up a Suite, not setting up a Suite's fixture. mySuite.setUpFixture() says what the method is doing. You are setting up a Suite's fixture.

If we change the method names to setUpFixture and tearDownFixture: 1) They will have proper camel case. 2) They will be consistent with -- though not exactly the same as -- JUnit naming. 3) Most people will use code completion to type the names anyway, so the extra 7 characters aren't so costly in finger typing. 4) They will be clear about saying what they do in their name.

Comments?

Phil Sager

Posts: 1
Nickname: deepfrze
Registered: Jan, 2003

Re: What Do You Think About setupFixture and cleanupFixture? Posted: Feb 13, 2003 1:11 PM
Reply to this message Reply
Hi; as a new user I only recently downloaded SuiteRunner, and am now learning how to use it.

I do like your latest arguments, setUpFixture() and tearDownFixture(). This doesn't shorten the names, however almost every time I shorten names for expediency, I end up regretting it later...

Phil

Brooke Wilmoth

Posts: 7
Nickname: brooke
Registered: Jan, 2003

Re: What Do You Think About setupFixture and cleanupFixture? Posted: Feb 13, 2003 2:19 PM
Reply to this message Reply
Having been extremely confused by setUp() and tearDown() in JUnit, I would appreciate clarity of the method name above and beyond the shortened typing. Therefore I affirm your decision to have the names "setUpFixture()" and "tearDownFixture()" in the SuiteRunner API.

Michael Wiedmer

Posts: 15
Nickname: micks
Registered: Aug, 2002

Re: What Do You Think About setupFixture and cleanupFixture? Posted: Feb 14, 2003 6:51 AM
Reply to this message Reply
Hi there,


I must confess, I am one of the few people who have gone for SuiteRunner instead of JUnit _and_ used setupFixture() and cleanupFixture().
I have done so, for the same reason that you had to come up with SuiteRunner: its components are so much clearer in its naming and intent.

I have no problem with an IDE or mouse assisting me in writing long, descriptive method names.

I agree with Bill that any beta is very fluid with regards to its API, so I don't mind refactoring.

I don't agree with him, however, on sticking to JUnit's API. You have gone away from it because of clarity. Why now go back and try pretend to be JUnit again? And then only halfway? I would not like to see that as the reason for renaming your methods.

Nitpicking on the English language would require us tearing down a fixture rather than simply cleaning it up, though.


IMHO & 2ctsWorth,

Micks

Flat View: This topic has 5 replies on 1 page
Topic: Artima SuiteRunner v1.0beta4 Released Previous Topic   Next Topic Topic: running without -g

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use