Max Ni
Max Ni

Reputation: 183

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?

Upvotes: 16

Views: 23051

Answers (1)

Deepak Bala
Deepak Bala

Reputation: 11185

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.

Upvotes: 23

Related Questions