ant junit任务动态转储控制台输出的选项
我在使用Ant junit任务启动非回归测试时遇到了一个问题:控制台输出仅在测试结束时转储。当与进程Xmx相关的日志过多时,它会导致一些OOM,这意味着如果进程在结束之前死亡(或被看门狗杀死),日志将丢失ant junit任务动态转储控制台输出的选项,ant,junit,log4j,Ant,Junit,Log4j,我在使用Ant junit任务启动非回归测试时遇到了一个问题:控制台输出仅在测试结束时转储。当与进程Xmx相关的日志过多时,它会导致一些OOM,这意味着如果进程在结束之前死亡(或被看门狗杀死),日志将丢失 <junit fork="true" forkmode="once" timeout="1200000" haltonfailure="no" outputtoformatters="yes" failureProperty="test.failure" dir="${project
<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)来解决这个问题。但是,我们非常希望测试应用程序的控制台输出日志
是否有一个设置允许ant junit任务动态地将控制台输出转储到文件中,而不等待测试套件结束
谢谢 向junit命令添加showoutput=“true”
参数:
<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”
和格式化程序。这是有问题的,因为这意味着test stdout&stderr在输出窗口中出现两次(在运行时,因为showoutput
标志,在执行后,因为格式化程序)。格式化程序可以写入文件(就像默认情况下那样的xml格式化程序),在这种情况下可以使用showoutput=“true”和格式化程序。