ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stefano Mancarella" <stefano.mancare...@caboto.it>
Subject Re: JUnit: setUp() method called multiple times ?
Date Thu, 03 Oct 2002 10:16:05 GMT
P. Fleury wrote:
> ... 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 ? :-)

The setUp() method is meant to be used to assure that each test runs in 
the same test environment.
The tearDown() method is meant to be used to release resources 
eventually obtained by setUp() (e.g. JDBC connections, etc.).
These two methos are called before and after each test to assure that 
the execution of a test doesn't affect the other tests.
For example, a test could succeed just because a preceding one has 
changed the environment in some way. If you start from scratch each 
time, this can't happen.


--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message