开发者

Junit Ant Task, output stack trace

I have a number of tests failing in the following JUnit Task.

 <target name="test-main" depends="build.modules" description="Main Integration/Unit tests">
        <junit fork="yes"
               description="Main  Integration/Unit Tests"
               showoutput="true"
               printsummary="true"
               outputtoformatters="true">
            <classpath refid="test-main.runtime.classpath"/>
            开发者_如何转开发<batchtest filtertrace="false" todir="${basedir}">
                <fileset dir="${basedir}" includes="**/*Test.class" excludes="**/*MapSimulationTest.class"/>
            </batchtest>
        </junit>
    </target>

How do I tell Junit to ouput the errors for each test so that I can look at the stack trace and debug the issues.


You'll need to add the formatter task as a child of the batchtest task (NOT as the immediate child of the junit task)

The syntax of formatter is:

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

type can be one of plain, brief, xml or failure.

usefile="false" asks Ant to send output to the console.

Scroll down to the h4 on "formatters" at http://ant.apache.org/manual/Tasks/junit.html for more details.


The answer was to add the tag within the tag.

 <target name="test-main" depends="build.modules" description="Main Integration/Unit tests">
        <junit fork="yes"
               description="Main  Integration/Unit Tests"
               showoutput="true"
               printsummary="true"
               outputtoformatters="true">
            <classpath refid="test-main.runtime.classpath"/>
            <batchtest filtertrace="false">
                <fileset dir="${basedir}/out/test/common" includes="**/*Test.class" excludes="**/*MapSimulationTest.class"/>
                <fileset dir="${basedir}/out/test/test-simulation" includes="**/*Test.class" excludes="**/*MapSimulationTest.class"/>
            </batchtest>
            <formatter type="brief" usefile="false"/>
        </junit>
    </target>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜