New instance for each Test method?
1 posts in topic
Flat View  Flat View

Posted By:   Nikhil_Varma
Posted On:   Tuesday, May 13, 2003 06:48 AM

Hello all,

I was reading an article which says this:...

"JUnit follows a very specific sequence of events when invoking tests.First,it constructs a newinstance of the test case for each test method.Thus,if you have five test
methods,JUnit constructs five instances of your test case.For this reason,instance variables cannot be used to
share state between test methods."

What would be the benefit from contructing a new instance for each test method?


Re: New instance for each Test method?

Posted By:   Christopher_Koenigsberg  
Posted On:   Tuesday, May 13, 2003 06:56 AM

Making sure there is no interaction, nothing lingering from a previous instance, on a new instance? (which might otherwise cover up a problem, e.g. in initialization)

About | Sitemap | Contact