Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JUnit test hangs

I have the following problem: one of my JUnit tests gets stuck in eclipse doing nothing, but the blue arrow indicating that this test is currently running persists.

There definitely isn't any infinite loop in my code, and everything in the tested method that gets stuck is in the following for loop:

for (int i = 0; i < this.length(); i += 3) {
    // do some stuff
}

Also, when debugging, the method properly terminates and does not let me step any more.

In the setUp() I am initializing my fields and the class under test.

This seems like some weird JUnit/Eclipse bug. I am running Eclipse 3.7.2 and JUnit 4 under Ubuntu 12.04 using oracle-java-7.

Any tips how to troubleshoot this problem?

like image 282
Max Ni Avatar asked Apr 19 '13 10:04

Max Ni


1 Answers

If the test is still running, you can look at the active threads in the debug tab and suspend them by pressing the pause button. That will tell you where the test is stuck.

like image 163
Deepak Bala Avatar answered Oct 17 '22 19:10

Deepak Bala