【发布时间】:2014-11-12 11:04:27
【问题描述】:
我想为通过的测试用例打印字符串消息。我可以使用fail() 方法打印失败案例的消息。如何打印通行证信息?
public class TestCaseTesting extends TestCase {
@Test
public void testFailTesting() {
fail("Fail message");
}
@Test
public void testpassTesting() {
//what method i need to write here to show message of pass cases
//fail("Fail message");
}
}
build.xml 的代码
<target name="generate-report">
<junitreport todir="${reports}">
<fileset dir="${reports}/raw/">
<include name="TEST-*.xml" />
</fileset>
<report format="noframes" todir="${reports}\html\" />
</junitreport>
</target>
【问题讨论】:
-
打印消息以便它们出现在准确的位置?如果您从控制台运行测试,打印到标准输出的消息将出现在测试输出中。
-
我正在生成 html 报告,在该报告中我想显示通过案例的消息。 stdout 对控制台很好,但我想在报告中打印消息。当我们使用 fail() 方法显示失败消息时,是否有任何传递案例消息的方法。
-
您使用什么来生成 HTML 报告?你用什么来执行测试?
-
我正在使用 Ant 脚本生成报告