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

查看:98
本文介绍了是否有可能为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 /蚂蚁,他们都跑了。任何对此的思考?

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 任务。

例如

尝试在您的junit任务此属性:

Try this attribute on your junit task:

printsummary =YES上junit任务

您格式更改为:

<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天全站免登陆