3

Looking at the informal spec at from this question, I notice that there is no element for errors. Is that just an oversight? CruiseControl seems to extract errors from somewhere.

<testsuites>
  <testsuite name="name" errors="1" failures="0">
    <testcase name="name">
      <error>Some error message</error>
    </testcase>
  </testsuite>
</testsuites>
Community
  • 1
  • 1
dromodel
  • 9,581
  • 12
  • 47
  • 65

2 Answers2

1

You can view this article. The modified sample from this article:

<target name="test">
    <junit printsummary="withOutAndErr" fork="off" haltonfailure="no">
        <classpath refid="classpath.test"/>
        <formatter type="brief" usefile="false"/>
        <test name="packagename.MyTest"/>
    </junit>
</target>

You can see all messages from junit tests in console (or in report file) You can read about printsummary, haltonfailure properties and the other ones at the ant site.
The other useful link.

Alex K
  • 22,315
  • 19
  • 108
  • 236
  • 1
    I'm not using Ant but rather creating a script which tries to be compatible (CI tools) and so just need to know how the standard handles errors. – dromodel Oct 27 '11 at 18:46
0

I know it's been a while, but, there is an element for errors, and you can distinguish between errors and failures:

<?xml version="1.0" encoding="utf-8"?>
<testsuites errors="1" failures="2" tests="5" time="10">
    <testsuite errors="1" failures="2" id="0" name="TestSuite1" tests="4" timestamp="2015-04-20T00:00:00">
        <testcase classname="ModuleIAmTesting" name="testDoNothingDoesNothing" time="1"/>
        <testcase classname="ModuleIAmTesting" name="testLongThingTakesALongTime" time="5"/>

        <testcase classname="ModuleIAmTesting" name="testSkyIsBlue" time="1">
            <failure message="Test testSkyIsBlue() failed!" type="failure">
                It's storming; sky is gray today. Failure output, details, etc.
            </failure>
        </testcase>

        <testcase classname="ModuleIAmTesting" name="testIsNotStorming" time="1">
            <failure message="Test testIsNotStorming() failed!" type="failure">
                Another failure. Failure output, details, etc.
            </failure>
        </testcase>

        <testcase classname="ModuleIAmTesting" name="testCreatePlugin" time="2">
            <error message="Error while executing test testCreatePlugin()!" type="error">
                Unhandled catastrophic exception in ModuleIAmTesting.cpp at like 4420, details, etc.
            </error>
        </testcase>
    </testsuite>
</testsuites>

The important part is the <error> tag and the errors attribute to <testsuite>.

Will
  • 24,082
  • 14
  • 97
  • 108