You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Guillory, Stanford" <gu...@vignette.com> on 2001/12/16 15:39:17 UTC

JUnit task: setUp() called before every test method

I am using the junit task. However, I am noticing that the
setUp() method of my TestCase classes is being called
before every testX() method in the class, as opposed to
once before all the testX() methods are called.

This appears quite wrong, but I haven't looked into whether
it's an ant junit task thing or a junit thing. Any ideas
as to what I'm doing wrong? I use the batch test feature
of junit, and use the dynamic test suite construction method,
i.e, every TestCase class has a suite() method that supplies
the name of the TestCase class so that all the methods
starting with "test" are gathered through reflection.

Thanks,
Stanford S. Guillory
 

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: JUnit task: setUp() called before every test method

Posted by Rolf Katzenberger <rf...@gmx.net>.
Hi Stanford,

On Sun, 16 Dec 2001 08:39:17 -0600, "Guillory, Stanford"
<gu...@vignette.com> wrote:

>I am using the junit task. However, I am noticing that the
>setUp() method of my TestCase classes is being called
>before every testX() method in the class, as opposed to
>once before all the testX() methods are called.
>
>This appears quite wrong, but I haven't looked into whether
>it's an ant junit task thing or a junit thing. Any ideas
>as to what I'm doing wrong?

This behaves as defined, setUp() is called before every test (i.e.
testX() method):

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

You can find lots of documentation, tutorials, etc at www.junit.org.


Regards,
Rolf

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>