Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 276
benstpierre Avatar asked May 07 '10 21:05

benstpierre


1 Answers

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.

like image 63
AbdullahC Avatar answered Oct 03 '22 04:10

AbdullahC