本文介绍了如何获取JUnit测试(从Ant脚本驱动)转储导致失败的异常堆栈?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我们从Ant脚本运行JUnit测试,如下所示。当测试失败时,我希望它输出异常的堆栈转储来阻止故障,但不会。有没有办法让它倾倒?
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
推荐答案
在这之前,我看到。我认为这个问题是重复的。
I've posted this here before I saw this question. I think this question is a duplicate.
这是我的junit标签,它会产生异常跟踪
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"
/>
这篇关于如何获取JUnit测试(从Ant脚本驱动)转储导致失败的异常堆栈?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!