we run our junit tests in Eclipse seems fine, but when we move it to hudson or jenkins, the tests seems hangs there never returns. its definitely the same code, I just wandering whats the difference between running tests in Eclipse and Hudson.
-
they have to hang somewhere, look into the logs, add some logging, in other words add more details to the discussion – Kris Feb 03 '12 at 14:34
-
the log shows, there is a database dead lock, or the test just hangs there (I am changing the test anyway), but the question is why it is never happens in eclipse but always happens in Jenkins. – Junchen Liu Feb 03 '12 at 14:42
-
maybe a connection/connection pool issue? – Kris Feb 03 '12 at 14:46
-
hum....maybe but I wander why connection pool problem does show in Eclipse? unless I know different way to run eclipse and jenkins, I can't find it out. – Junchen Liu Feb 03 '12 at 14:51
-
It seems to be related to [this](https://issues.jenkins-ci.org/browse/JENKINS-10234) problem. I am dealing with this problem too. Unfortunately, neither jenkins nor the junit plugin writer seems to be keen on fixing this. – horatius Oct 05 '13 at 17:24
3 Answers
In eclipse you usually just run one test class or one test method. A "fresh" Java Virtual machine is started and stopped for this test.
I suppose that Jenkins runs all tests in one Java Virtual machine. This can make a huge difference.
Try to run all test outside eclipse and outside hudson at once (should be simple if you have a maven project). What is the result? Maybe you can configure your test run to fork the Java VM on each test (this is possible with maven by configuring the surefire plugin).

- 47,963
- 16
- 124
- 157
-
yeh!! thats what I want hear, seems heading to the right direction, a simple mvn test outside eclipse, runs fine. I am really interested in how to config surefire to fork the JVM, wander if you know how? also how sure are you about the a "fresh" JVM starts and stops for each test in eclipse? thanks! – Junchen Liu Feb 03 '12 at 16:39
-
Eclipse starts a new JVM each time if you press the Run (or Debug) button. But if your tests run fine in mvn test, then it is not likely that this is the issue. – Zoltán Ujhelyi Feb 03 '12 at 17:48
-
@shanyangqu If `mvn test` runs fine it does not seem to be necessary to fork the JVM. Nevertheless you can try to set the [forkMode](http://maven.apache.org/plugins/maven-surefire-plugin/test-mojo.html#forkMode) configuration property to `always` (details [here](http://stackoverflow.com/q/3185850/367285)) – FrVaBe Feb 03 '12 at 20:54
My guess would be to look at the memory limit. Try to increase the memory limit of the maven process started from Jenkins.
My other guess would be to look whether the Maven build from Jenkins is allowed to execute submodules parallel. If yes, it might cause some race conditions that are hard to find.

- 13,788
- 2
- 32
- 37
Are the tests executed in the same way in Eclipse and in Hudson? My guess is that the tests are executed one by one (or class by class) in Eclipse, and by a build script such as Maven or Ant in Hudson? What happens if you execute the test suite from a terminal on your local machine?

- 32,104
- 16
- 121
- 156