This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Testing and the fly likes JUnit Threads still running after test ends Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » Testing
Bookmark "JUnit Threads still running after test ends" Watch "JUnit Threads still running after test ends" New topic
Author

JUnit Threads still running after test ends

Zeki Karaca
Greenhorn

Joined: Oct 02, 2009
Posts: 20
Hi all,

I need some advice/help. I have a test suite as follows:



A test abstraction class:



A test as follows:



When i test this by running the test suite, a few threads are started in eclipse. After my test ends, these thread are still running. When i want to test again, again a few threads are started and this keeps going on and slows down the whole system everytime i try to test. Why are these threads not stopped? Should i use tearDown() to do this manually somewhere? Any help would be appreciated.


SCJA | SCJP 6.0 | ...
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

You need to stop your Selenium.
Zeki Karaca
Greenhorn

Joined: Oct 02, 2009
Posts: 20
And where would i do that? In a tearDown() method? If so, where? I have 3 different classes, as seen above (all extend TestCase (in)directly).
Zeki Karaca
Greenhorn

Joined: Oct 02, 2009
Posts: 20
I am using Selenium RC with Java. Part of my code is here:



The selenium session is not killed! Selenium.stop() is not working? See generated output:

starting
com.thoughtworks.selenium.DefaultSelenium@1abc7b9
stopping
alive
com.thoughtworks.selenium.DefaultSelenium@1abc7b9


As i told before, some of the threads that are started are still running. What am i doing wrong?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JUnit Threads still running after test ends
 
Similar Threads
running the selenium(java) script close the browser
setUp and teardown not working
Junit4+Eclipse+Selenium RC- Test class should have exactly one public zero-argument constructor
JUnit. How to pass parameters into Test classes from suite() ?
Test Suites