2010-03-19 41 views

回答

2

我已經發布了這個答案this question才意識到它是你的副本。

這是我的junit標籤,它產生異常跟蹤。

<junit 
    showoutput="yes" 
    errorProperty="test.failed" 
    failureProperty="test.failed" 
    haltOnFailure="${test.halt-on-failure}" 
    fork="yes" 
    forkmode="${junit.forkmode}" 
> 
    <classpath> 
    <pathelement location="${classes.dir}"/> 
    <pathelement location="${classes-under-test.classes.dir}" /> 
    </classpath> 

    <!-- #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> 

我認爲這會爲你做它的一個嵌套元素是

<formatter 
    type="brief" 
    usefile="false" 
    /> 
0

有JUnit中BaseTestRunner限制該值的設置:

/** 
    * Truncates a String to the maximum length. 
    */ 
public static String truncate(String s) { 
    if (fgMaxMessageLength != -1 && s.length() > fgMaxMessageLength) 
     s= s.substring(0, fgMaxMessageLength)+"..."; 
    return s; 
} 

您可以更改此值通過設定:

BaseTestRunner.setPreference("maxmessage", "-1"); 
相關問題