2012-04-15 21 views
2

我的測試目標看起來如下:如何使用ANT將jUnit輸出摺疊爲摘要?

<target name="test" depends="compileTest"> 
    <junit haltonfailure="yes"> 
     <classpath> 
      <pathelement location="bin" /> 
      <pathelement location="lib/xstream-1.4.2.jar" /> 
      <pathelement location="lib/jettison-1.2.jar" /> 
     </classpath> 
     <formatter type="plain" usefile="false" /> 

     <batchtest> 
      <fileset dir="${test-src}"> 
       <include name="**/*Test*" /> 
      </fileset> 
     </batchtest> 
    </junit> 
</target> 

和輸出如下所示:

test: 
    [junit] Testsuite: app.commons.error.test.ShellErrorMessageTest 
    [junit] Tests run: 9, Failures: 0, Errors: 0, Time elapsed: 0.006 sec 
    [junit] Testcase: testCreateNormal took 0.003 sec 
    [junit] Testcase: testGetSectionSeparatorLine took 0.001 sec 
    [junit] Testcase: testGetSectionSeparatorLineMultipleSymbols took 0 sec 
    [junit] Testcase: testGetSectionSeparatorLineEmptySymbol took 0 sec 
    [junit] Testcase: testGetSectionSeparatorLineEmptySymbolSpace took 0 sec 
    [junit] Testcase: testGetSectionSeparatorLineNull took 0 sec 

我怎麼能這樣輸出坍縮成1行總結?

有沒有辦法接收1路輸出沿着線加入

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

「冉500次測試。0失敗,0錯誤」

回答

1

您可以設置unverbose JUnit的輸出在<junit>之內。

爲了進一步降低它,下面的選項來我的腦海:

+0

即使使用'brief formatter',我也看到很多輸出 – JAM 2012-04-16 00:16:01