Ant 目标生成空套件 xml 文件
我在我的项目中使用 ant,并且一直在尝试使用 ant 目标生成 JUnit 报告。我遇到的问题是在执行结束时我的 TESTS-TestSuites.xml 是空的。但所有其他单独的测试 xml 文件都有数据。因此,我的 html 报告是空的,从某种意义上说,结果显示“0”。
这是我的 ant 目标
<!-- JUnit Reporting -->
<target name="test-report" depends="build-all" description="Generate Test Results as HTML">
<taskdef name="junitreport" classname="org.apache.tools.ant.taskdefs.optional.junit.XMLResultAggregator"/>
<junit printsummary="on" haltonfailure="off" haltonerror="off" fork="yes">
<batchtest fork="yes" todir="${test.reports}" filtertrace="on">
<fileset dir="${build.classes}" includes="**/Test*Selenium.class"/>
</batchtest>
<formatter type="plain" usefile="false"/>
<formatter type="xml" usefile="true"/>
<classpath>
<path refid="classpath"/>
<path refid="application"/>
</classpath>
</junit>
<echo message="running JUnit Report" />
<junitreport todir="${test.reports}">
<fileset dir="${test.reports}">
<include name="Test-*.xml" />
</fileset>
<report format="frames" todir="${test.reports.html}" />
</junitreport>
</target>
这是我得到的 ant 打印摘要,
[junitreport] Processing C:\YukonSelenium\reports\TESTS-TestSuites.xml to C:\DOCUME~1\user\LOCALS~1\Temp\null1848051184
[junitreport] Loading stylesheet jar:file:/C:/DevApps/apache-ant-1.7.1/lib/ant
junit.jar!/org/apache/tools/ant/taskdefs/optional/junit/xsl/junit-frames.xsl
[junitreport] Transform time: 859ms
[junitreport] Deleting: C:\DOCUME~1\user\LOCALS~1\Temp\null1848051184
这是 junit 报告的样子 http://www.freeimagehosting.net/image.php?43dd69d3b8.jpg
预先感谢,
I am using ant for my project and I have been trying to generate JUnit report using ant target. The problem I run in to is that at the end of the execution my TESTS-TestSuites.xml is empty. But all the other individual test xml files have data. And due to this my html reports are empty, in the sense results shows "0".
Here is my ant target
<!-- JUnit Reporting -->
<target name="test-report" depends="build-all" description="Generate Test Results as HTML">
<taskdef name="junitreport" classname="org.apache.tools.ant.taskdefs.optional.junit.XMLResultAggregator"/>
<junit printsummary="on" haltonfailure="off" haltonerror="off" fork="yes">
<batchtest fork="yes" todir="${test.reports}" filtertrace="on">
<fileset dir="${build.classes}" includes="**/Test*Selenium.class"/>
</batchtest>
<formatter type="plain" usefile="false"/>
<formatter type="xml" usefile="true"/>
<classpath>
<path refid="classpath"/>
<path refid="application"/>
</classpath>
</junit>
<echo message="running JUnit Report" />
<junitreport todir="${test.reports}">
<fileset dir="${test.reports}">
<include name="Test-*.xml" />
</fileset>
<report format="frames" todir="${test.reports.html}" />
</junitreport>
</target>
This is what I get as ant print summary,
[junitreport] Processing C:\YukonSelenium\reports\TESTS-TestSuites.xml to C:\DOCUME~1\user\LOCALS~1\Temp\null1848051184
[junitreport] Loading stylesheet jar:file:/C:/DevApps/apache-ant-1.7.1/lib/ant
junit.jar!/org/apache/tools/ant/taskdefs/optional/junit/xsl/junit-frames.xsl
[junitreport] Transform time: 859ms
[junitreport] Deleting: C:\DOCUME~1\user\LOCALS~1\Temp\null1848051184
Here's how junit report looks like
http://www.freeimagehosting.net/image.php?43dd69d3b8.jpg
Thanks in advance,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为它的问题与案件有关。您已经说过 Test-.xml。我认为它应该是 TEST-.xml
这就是为什么它不聚合结果。有关详细信息,请将 ant 选项指定为 -v。您可以看到所有文件报告目标拾取的内容。
I think its issue related to case. You have said that Test-.xml. I think It should be TEST-.xml
That's why its not aggregating results. For more information give ant option as -v. u can see what all files report target picked up.