Erik Hatcher wrote:

> Correct.  This is just the way JUnit works (regardless of it being run 
> from Ant or otherwise).  setUp(), testXXX, tearDown().... setUp(), 
> testZZZ(), tearDown() - that is the JUnit-way, call setUp(), then a 
> test method, then tearDown() repeatedly.
>
>     Erik
>
Mmm. Well, if in my class, I have 3 test functions which needs some 
object to be initialized to run properly. Now it takes a looong time to 
setup that object, so in the current situation, if my class is

class MyBigTest {
    protected void setUp() {
     // long creation of object
     MyObject obj= ...;
    }

    public void testFunction1() { /* use obj */ }
    public void testFunction2() { /* use obj */ }
    public void testFunction3() { /* use obj */ }

}

and if I create a TestSuite giving it the MyBigTest.class, it will 
actually create the big object 3 times for my three test functions!
I though that the setUp() and tearDown() methods were here for exactly 
that purpose. If not, what are they here for ? :-)

It's my last post here about this, it's getting out of topic, I think.

--Pascal



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to