eclipsejunitinfinite-loop

How to kill a JUnit test run in Eclipse that has entered an infinite loop


I have some Java code that I am unit testing using JUnit, running inside Eclipse (Neon). It so happens that some code under test has a bug in it, causing it to enter an infinite loop. The JUnit run then, of course, does not finish. How do I kill the test run?

The button for stopping the test run ("Stop JUnit Test Run") does not work well: the GUI seems to think that it has stopped the test run, but a look at the CPU activity (using top, for example), shows that a Java thread is still running. I can kill the thread myself by sending it a kill signal. But that seems a kludge and is inconvenient. Is there a better way, available within Eclipse itself?


Solution

  • Kill it from the console view, using the red button. This stops the process.

    enter image description here

    Stopping it from the junit view only asks it to stop.