【发布时间】:2012-01-09 15:50:09
【问题描述】:
我得到了以下 JUnit 东西在 ant 上运行良好,但到目前为止我还没有找到如何在我的 main() 方法中使用我的格式化程序(当不使用 ant 时)。
这是蚂蚁任务:
<junit printsummary="true" errorProperty="test.failed" failureProperty="test.failed">
<classpath refid="test.class.path" />
<!-- use multiple formatters -->
<formatter type="brief" usefile="false" />
<!-- console log -->
<formatter type="xml" classname="x.selenium.output.SeleniumFrameworkFormatter" />
<!-- file log -->
<test name="x.selenium.SeleniumFramework" haltonfailure="no" outfile="result" todir="${build.temp.dir}" />
<junit>
在 Java 代码中,我有这个作为替代方案,但这会打印到控制台,而不是使用我的格式化程序来创建一个漂亮的 html 文件:
JUnitCore junit = new JUnitCore();
Result result = junit.run(classes);
有谁知道如何在 Java 代码中做类似的事情? 谢谢!
【问题讨论】:
-
您使用的是什么版本的 JUnit?