Note that there are some explanatory texts on larger screens.

plurals
  1. POJUnit fails but no tests report as failing
    primarykey
    data
    text
    <p>I am running JUnit tests using Ant on the command line on Windows XP. </p> <p>On some runs, midway through running all of the tests, I will get a <code>BUILD FAILED</code> message pointing at a specific test class, but all of the tests in that class are reported as having passed both in the console output and in the XML file. </p> <p>The class contains no non-determinism and should not have any side-effects. There is no reason for it to be running out of memory either. </p> <p>What could cause these strange build failures?</p> <hr> <p><strong>Update</strong>:</p> <p>I doubt this will be helpful, but here is the end of the run when it fails (modified directory and package names for anonymity):</p> <pre><code>C:\proj\er20\rr&gt; ant clean build test &lt;snip/&gt; [junit] Running com.example.PathUTest [junit] Tests run: 6, Failures: 0, Errors: 0, Time elapsed: 7.5 sec BUILD FAILED C:\proj\er20\common\build.xml:385: The following error occurred while executing this line: C:\proj\er20\rr\build.xml:58: Test com.example.PathUTest failed </code></pre> <hr> <p><strong>Update 2</strong>:</p> <p>I have finally managed to get the failure to happen with -verbose enabled. Here is the stacktrace (copied by hand):</p> <pre><code>BUILD FAILED C:\proj\er20\common\build.xml:385: The following error occurred while executing this line: C:\proj\er20\rr\build.xml:58: Test com.example.PathUTest failed at org.apache.tools.ant.ProjectHelper.addLocationToBuildException(ProjectHelper.java:541) at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:418) at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:105) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288) at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105) at org.apache.tools.ant.Task.perform(Task.java:348) at org.apache.tools.ant.Target.execute(Target.java:357) at org.apache.tools.ant.Target.performTasks(Target.java:385) at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329) at org.apache.tools.ant.Project.executeTarget(Project.java:1298) at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) at org.apache.tools.ant.Project.executeTargets(Project.java:1181) at org.apache.tools.ant.Main.runBuild(Main.java:698) at org.apache.tools.ant.Main.startAnt(Main.java:199) at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257) at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104) Caused by: C:\proj\er20\rr\build.xml:58: Test com.example.PathUTest failed at org.apache.tools.ant.taskdefs.optionl.junit.JUnitTask.actOnTestResult(JUnitTask.java:1712) at org.apache.tools.ant.taskdefs.optionl.junit.JUnitTask.execute(JUnitTask.java:820) at org.apache.tools.ant.taskdefs.optionl.junit.JUnitTask.executeOrQueue(JUnitTask.java:1657) at org.apache.tools.ant.taskdefs.optionl.junit.JUnitTask.execute(JUnitTask.java:764) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288) at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105) at org.apache.tools.ant.Task.perform(Task.java:348) at org.apache.tools.ant.Target.execute(Target.java:357) at org.apache.tools.ant.Target.performTasks(Target.java:385) at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329) at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38) at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:416) ... 17 more --- Nested Exception --- C:\proj\er20\rr\build.xml:58 Test com.example.PathUTest failed at org.apache.tools.ant.taskdefs.optionl.junit.JUnitTask.actOnTestResult(JUnitTask.java:1712) at org.apache.tools.ant.taskdefs.optionl.junit.JUnitTask.execute(JUnitTask.java:820) at org.apache.tools.ant.taskdefs.optionl.junit.JUnitTask.executeOrQueue(JUnitTask.java:1657) at org.apache.tools.ant.taskdefs.optionl.junit.JUnitTask.execute(JUnitTask.java:764) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288) at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105) at org.apache.tools.ant.Task.perform(Task.java:348) at org.apache.tools.ant.Target.execute(Target.java:357) at org.apache.tools.ant.Target.perform(Target.java:385) at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329) at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38) at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:416) at org.apache.tools.ant.tskdefs.CallTarget.execute(CallTarget.java:105) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288) at sun.reflect.GeneratedMethodAccessor4.invoke(Source Unknown) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105) at org.apache.tools.ant.Task.perform(Task.java:348) at org.apache.tools.ant.Target.execute(Target.java:357) at org.apache.tools.ant.Target.performTasks(Target.java:385) at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329) at org.apache.tools.ant.Project.executeTarget(Project.java:1298) at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) at org.apache.tools.ant.Project.executeTargets(Project.java:1181) at org.apache.tools.ant.Main.runBuild(Main.java:698) at org.apache.tools.ant.Main.startAnt(Main.java:199) at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257) at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104) Total time: 1 minute 27 seconds </code></pre> <p>And here is the relevant Ant target:</p> <pre><code>&lt;target name="test"&gt; &lt;taskdef resource="net/sf/antcontrib/antcontrib.properties"&gt; &lt;classpath&gt; &lt;pathelement location="../buildsupport/lib/ant-contrib-1.0b3.jar"/&gt; &lt;/classpath&gt; &lt;/taskdef&gt; &lt;!-- line 58 is the next line --&gt; &lt;junit printsummary="yes" fork="yes" haltonfailure="yes" dir="${test-dir}" showoutput="yes"&gt; &lt;jvmarg value="-Xmx10200M"/&gt; &lt;jvmarg value="-Xms600M"/&gt; &lt;jvmarg value="-server"/&gt; &lt;jvmarg value="-Dlog4j.configuration=file:log4j.xml"/&gt; &lt;jvmarg value="-XX:CompileCommand=exclude,com.example.GtaCore,expandLabel"/&gt; &lt;env key="LD_LIBRARY_PATH" path="${env.LD_LIBRARY_PATH}:${test-dir}/native_lib"/&gt; &lt;jvmarg value="-Djava.library.path=./native_lib"/&gt; &lt;formatter type="xml"/&gt; &lt;classpath&gt; &lt;!-- classpath items --&gt; &lt;/classpath&gt; &lt;batchtest&gt; &lt;fileset includes="**/*Test.class" excludes="**/*$$*.class"/&gt; &lt;/batchtest&gt; &lt;/junit&gt; &lt;junitreport&gt; &lt;!-- config --&gt; &lt;/junitreport&gt; &lt;echo&gt; finished suite&lt;/echo&gt; &lt;/target&gt; </code></pre> <hr> <p><strong>Probable Cause and Solution</strong></p> <p>We discovered that deep down within code that we were calling, an error debugging GUI was being displayed which ran in another thread. Since disabling the display of this GUI, we have not seen this issue again.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload