蚂蚁junit任务选项倾倒控制台输出上即时 [英] option for ant junit task to dump console output on-the-fly

查看:204
本文介绍了蚂蚁junit任务选项倾倒控制台输出上即时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Ant junit任务,推出我的非回归测试的时候有一个问题:控制台输出仅倾倒当测试结束。它会导致一些OOM当有相对于过程XMX太多的日志,意味着如果进程结束前死亡(或者被打死看门狗)日志丢失。

I have an issue when using the Ant junit task to launch my non-regression tests: the console output is only dumped when the test end. It causes some OOM when there are too many logs with respect to the process Xmx and means that if the process dies (or is killed by a watchdog) before its end the logs are lost.

<junit fork="true" forkmode="once" timeout="1200000" haltonfailure="no" 
 outputtoformatters="yes" failureProperty="test.failure" dir="${project.test.dir}">
  <junit-opts/>
  <formatter type="xml" />
  <formatter type="brief" />
  <test name="${project.test.suite}" todir="${report.junit.dir}" outfile="@{project.test.name}" />
</junit>

这个问题可以通过在文件倾销日志(我们使用log4j的一个记录API),肯定各地工作。但是,我们非常希望测试应用程序的控制台输出日志。

The issue could be worked around by dumping the logs in a file (we use log4j as a logging API), certainly. However we would very much like to test the console output logs of the application.

有没有允许告诉蚂蚁junit任务来转储控制台输出在即时的文件,而不是等待测试套件来结束设置?

Is there a setting permitting to tell the ant junit task to dump the console output in a file on-the-fly and not to wait for the test suite to end?

谢谢!

推荐答案

添加showoutput =真参数,JUnit的命令:

Add showoutput="true" parameter, to junit command:

<junit fork="true" showoutput="true" forkmode="once" timeout="1200000" haltonfailure="no" 
 outputtoformatters="yes" failureProperty="test.failure" dir="${project.test.dir}">
  <junit-opts/>
  <test name="${project.test.suite}" todir="${report.junit.dir}" outfile="@{project.test.name}" />
</junit>

避免使用showoutput =true和格式化。它是有问题的,因为这意味着测试标准输出&放大器;标准错误出现的两次在输出窗口的(在运行时,由于showoutput标志,并执行后,因为格式化)。

Avoid using showoutput="true" and formatters. It is problematic, because it means that test stdout & stderr appears twice in the Output Window (in runtime, because showoutput flag, and after execution, because formatters).

这篇关于蚂蚁junit任务选项倾倒控制台输出上即时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆