aspose file tools*
The moose likes Testing and the fly likes Test case with multithreads Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » Testing
Bookmark "Test case with multithreads" Watch "Test case with multithreads" New topic
Author

Test case with multithreads

Surasak Leenapongpanit
Ranch Hand

Joined: May 10, 2002
Posts: 341
Hi guys,
If a junit test case spawns new threads,
must all the threads terminate before the next test case is called?
Thanks
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
I believe this depends on whether these threads are "daemon" or "regular" threads.


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Andy Hunt
Author
Ranch Hand

Joined: May 01, 2001
Posts: 54
My memory on this is a little fuzzy, but as I recall JUnit as shipped has (or had) some bugs with regard to handling multiple threads.
There was a patch available from a 3rd party (just a Google away :-) that dealt with threads in a much more robust manner. In the patched version, I believe the answer to your question is "yes."


/\ndy Hunt<br /> <a href="http://www.PragmaticProgrammer.com" target="_blank" rel="nofollow">www.PragmaticProgrammer.com</a>
Surasak Leenapongpanit
Ranch Hand

Joined: May 10, 2002
Posts: 341
Thank you Lasse and Andy.
 
Don't get me started about those stupid light bulbs.
 
subject: Test case with multithreads