Java JUnitXML格式真的没有错误元素吗?
从中查看,我注意到没有错误元素。这只是疏忽吗?CruiseControl似乎从某处提取错误Java JUnitXML格式真的没有错误元素吗?,java,ant,junit,Java,Ant,Junit,从中查看,我注意到没有错误元素。这只是疏忽吗?CruiseControl似乎从某处提取错误 <testsuites> <testsuite name="name" errors="1" failures="0"> <testcase name="name"> <error>Some error message</error> </testcase> </testsuite> &
<testsuites>
<testsuite name="name" errors="1" failures="0">
<testcase name="name">
<error>Some error message</error>
</testcase>
</testsuite>
</testsuites>
一些错误消息
您可以查看此内容。本文中的修改示例:
<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>
您可以在控制台(或报告文件)中看到来自junit测试的所有消息
您可以在上阅读有关打印摘要、haltonfailure和其他属性的信息。另一个。我知道已经有一段时间了,但是,有一个错误元素,你可以区分错误和失败:
<?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>
暴风雨来袭;今天天空是灰色的。故障输出、详细信息等。
又一次失败。故障输出、详细信息等。
ModuleIAmTesting.cpp中未处理的灾难性异常,如4420、详细信息等。
重要的部分是
标记和
的errors
属性我不是在使用Ant,而是在创建一个试图兼容的脚本(CI工具),因此只需要知道标准如何处理错误。