I have a java junit test that passes when run alone on a development machine. We also have a hudson job which runs all the tests, invoked via ant, on a Mac OS X 10.4 node with Java 1.5. The test was passing in the hudson build until recently but now (with no related code changes) one test fails everytime with the following error:
Error Message
Forked Java VM exited abnormally. Please note the time in the report does not reflect the time until the VM exit.
Stacktrace
junit.framework.AssertionFailedError: Forked Java VM exited abnormally. Please note the time in the report does not reflect the time until the VM exit.
googling shows many others seem to have run into the same problem but there I couldn't find any answer.
For me, it was an "java.lang.OutOfMemoryError" in the forked VM (junit task with fork="yes") which made this message appear in the main VM.
The OutOfMemory was visible in the ant log (well, is visible since it's still present).
I use ant 1.7.1, so no hope with upgrading ant.
After putting the same VM parameters in "Run>External tools>External tools>JRE" than in Eclipse.ini (-Xms40m -Xmx512m -XX:MaxPermSize=256M) the problem is solved.
I keep fork to "no" to be sure ant use the parameters.
I believe I saw this error once when I ended up with multiple versions of junit on my classpath. Might be worth checking out.
I faced a similar issue. I ran the junit tests as an ant task. I added the showoutput="yes" ant junit property and ran the ant junit task. It then showed the exception stack trace that caused the forked jvm to exit.
Is the VM crashing ? Can you find a dump file (called
hs_err_pid*.log
) ? If that's the case, the dump file will give you clues to why this is crashing out.I faced the same issue. The problem was with byte code generation with mocking the Config class; We changed the import to
and it worked.
I faced the problem after reinstalling a new version of NetBeans to an external hard disk, upgrading Junit at the same time and using my old workspace.
For me the solution to the same problem was simple:
Just add the JUnit-Library to project
properties
=>Libraries
=>Compile Tests
andRun Tests
.So, in my case, it was just a missing library or a JUnit version conflict.