如何将stderr重定向到Ant JUnit目标中的stdout?

时间:2012-06-15 11:07:19

标签: ant junit

我有一个简单的Ant构建文件来生成XML格式的JUnit测试报告(见下文)。这会在stdout和stderr上生成一个报告,其中包含每个测试方法的输出(如果有)。我希望两个流的输出合并为每个测试方法一个。但我不知道该怎么做;如何告诉JUnit目标将stderr重定向到stdout?

<target name="test" depends="compile">
    <junit>
        <classpath refid="classpath.tests"/>
        <formatter type="xml"/>
        <test name="tests.Tests1"/>
        <test name="tests.Tests2"/>
    </junit>
</target>

1 个答案:

答案 0 :(得分:0)

ant test | grep -w junit 2>&1

Alternate选项是:使用q选项运行Ant。

ant -q test