Ant 是否可以在构建结束时列出失败的测试? [英] Is it possible for Ant to lists failed tests at the end of a build?

查看:24
本文介绍了Ant 是否可以在构建结束时列出失败的测试?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

来自另一个线程的以下代码段用于打印消息并在运行所有单元测试后失败:

The following snippet, from another thread, works to print a message and fail after all unit tests have been run :

<fail if="junit.failed" message="Oh no ! There were some failed unit tests :( "/>

但是 --- 我没有看到如何在 junit/ant 中记录和打印失败测试的名称,在它们全部运行后.对此有何想法?

However --- I don't see a how can I also record and print the NAMES of the failed tests in junit/ant, after they have all run. Any thoughts on this ?

我相信其他人会发现这样的功能非常重要,所以我假设存在一个简单的解决方案:查看数百次失败的测试是非常乏味的.

I believe others would find such function extremely important, so I'm assuming a simple solution exists : its quite tedious to look through hundreds of failed tests for the offenders.

推荐答案

是的.尝试使用 junitreport 任务.

Yes it is. Try using the junitreport task.

例如

在您的 junit 任务中试试这个属性:

Try this attribute on your junit task:

printsummary="yes" 在 junit 任务上

printsummary="yes" on junit task

将格式化程序更改为:

<formatter type="xml" />

然后创建具有调用此目标的报告:

and then create the reports with a target that calls this:

<junitreport>
<fileset dir="${testReport.dir}/tmp">
      <include name="*.xml" />
</fileset>
<report format="frames" styledir="${testReportXslt.dir}" todir="${finalReport.dir}/html" />
</junitreport>

对于输出:

    <concat>
        <fileset dir="${finalReport.dir}/html" includes="*.html"/>
        <filterchain>
            <linecontainsregexp>
                <regexp pattern='some pattern' />
            </linecontainsregexp>
        </filterchain>
    </concat>

这篇关于Ant 是否可以在构建结束时列出失败的测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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