如何使用ANT将jUnit输出折叠为摘要?

时间:2012-04-15 20:47:07

标签: 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行摘要?

有没有办法在“Ran 500测试中获得1行输出.0失败.0错误”

1 个答案:

答案 0 :(得分:1)

您可以通过添加

来设置unverbose junit-output
 <formatter type="brief" usefile="false"/>
<junit>

为了进一步减少它,我想到了以下选项: