我正在解析使用 Ant Task 生成的 xml Junit 报告。我看到通过测试用例的报告显示了执行的测试用例(方法)的确切名称,但不是失败的测试用例。
可以在下面验证......
<testcase classname="com.gui.LoginTest" name="blankFieldsTest" time="2.222" />
<testcase classname="com.gui.LoginTest" name="wrongUsernameOrPassword" time="2.233" />
<testcase classname="com.gui.LoginTest" name="successfulLoginTest" time="13.12" />
<testcase classname="junit.framework.TestSuite" name="com.gui.pool.ValidPoolTest" time="0.001">
<error message="Error communicating with the remote browser. It may have died.
Build info: version: '2.33.0', revision: '4e90c97', time: '2013-05-22 15:33:32'
System info: os.name: 'Windows Server 2008 R2', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_21'
Driver info: driver.version: RemoteWebDriver" type="org.openqa.selenium.remote.UnreachableBrowserException">org.openqa.selenium.remote.UnreachableBrowserException: Error communicating with the remote browser. It may have died.
Build info: version: '2.33.0', revision: '4e90c97', time: '2013-05-22 15:33:32'
System info: os.name: 'Windows Server 2008 R2', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_21'
Driver info: driver.version: RemoteWebDriver
</error>
</testcase>
我希望失败的测试用例的名称也出现在 xml 中,我应该使用什么配置?
这是我的蚂蚁任务的样子
<target name="test.helper" description="executed the junit task on compiled code and creates .xml reports">
<mkdir dir="${unit.test.dir}" />
<junit dir="${unit.test.dir}" fork="yes" printsummary="on" haltonfailure="no">
<batchtest fork="yes" todir="${unit.test.dir}">
<fileset dir="${test.classes.dir}">
<include name="**/TestSuite.class" />
</fileset>
</batchtest>
<formatter type="xml" />
<classpath>
<pathelement path="${test.classes.dir}" />
<fileset id="distjars" dir="${dist.lib.dir}">
<include name="**/*.jar" />
<exclude name="**/*_test.jar" />
</fileset>
<fileset id="selenium.jars" dir="${local.selenium.dir}/">
<include name="**/*.jar" />
</fileset>
</classpath>
</junit>
</target>