setup seems to be called for every test
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Peter_Craddock
Posted On:   Friday, April 25, 2003 04:51 AM

Its been some time since I have used JUnit but I thought setup was only called once when the TestCase was first started.

My setup seems to be called twice and caused a null reference in my second test.

Setup does not seem to complete the second time around before the test starts.

Is there anything I should do to make this only be executed once or whould I have a seperate setup method for each of my tests ?

Cheers,
Pete.

Re: setup seems to be called for every test

Posted By:   Vincent_Fischer  
Posted On:   Tuesday, May 27, 2003 11:04 AM

Do it in the constructor.



JUnit classes are called like this:

execute constructor

for each unit test do
execute setUp
execute test
execute teardown
end;

Re: setup seems to be called for every test

Posted By:   Anonymous  
Posted On:   Saturday, April 26, 2003 02:23 AM

The setUp method is called for each test method because tests are meant to be independent from each other.

Can you please elaborate on what you want to do?

About | Sitemap | Contact