views:

111

answers:

1

We run JUnit test from Ant script, as follows. When the test failed, I expect it to output the stack dump of the exception that casuses the failure, but it doesn't. Is there any trick to get it dumped?

<target description="Run JUnit tests" name="run-junit" depends="build-junit">
    <copy file="./AegisLicense.txt" tofile="test/junit/classes/AegisLicense.txt" overwrite="true"/>
    <junit printsummary="yes" haltonfailure="no" fork="yes" forkmode="once" failureproperty="run-aegis-junit-failed" showoutput="yes" filtertrace="off">
        <classpath refid="Aegisoft.testsupport.classpath"/>
        <classpath>
            <pathelement location="test/junit/classes"/>
        </classpath>
        <batchtest>
            <fileset dir="test/junit/src">
                <include name="**"/>
            </fileset>
        </batchtest>
    </junit>
 <fail
A: 

I've posted this here before I saw this question. I think this question is a duplicate.

Here is my junit tag that does produce the exception trace

  <!-- #Formatters for capture and display -->
  <formatter
    type="brief"
    usefile="false"
  />
  <formatter type="brief" />
  <formatter
    type="xml"
    if="test.generate.xml.output"
  />

  <!-- #Test case isolation technique -->
  <test
    name="${testcase}"
    if="testcase"
  />

  <batchtest
    todir="${test.data.dir}"
    unless="testcase"
  >
    <fileset dir="${classes.dir}">
      <include name="**/Test*.class" />
      <exclude name="**/Test*$*.class" />
    </fileset>
  </batchtest>

</junit>

I think the one nested element that will do it for you is

  <formatter
    type="brief"
    usefile="false"
  />
Alexander Pogrebnyak