Gradle中的JUnit侦听器配置 [英] JUnit Listener Configuration In Gradle

查看:91
本文介绍了Gradle中的JUnit侦听器配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Gradle的新蜜蜂.有自定义的JUnit侦听器,它可以读取自定义的注释数据并生成报告,并且需要将其配置为Gradle的一部分.无论如何,在Gradle 4.4中是否可以在surefire插件下方进行配置.

I'm new bee to Gradle. Have custom JUnit Listener, which reads the custom annotation data and generates report and need to configure it as part of Gradle. Is there anyway to configure below surefire plugin in Gradle 4.4.

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.18.1</version>
    <configuration>
        <properties>
            <property>
                <name>listener</name>
                <value>my.company.MyRunListener</value>
            </property>
        </properties>
    </configuration>
</plugin>

我了解,可能无法像在gradle中那样使用maven插件.我检查了 TestListener ,它没有不支持阅读注释以继续进行操作.

I understand that, it may not possible to use maven plugin as is in gradle. I checked TestListener, it doesn't have support to read annotations to proceed with that.

我想了解在Gradle中配置我的JUnit侦听器的方法.

I would like to understand the way to configure my JUnit Listener in Gradle.

推荐答案

很抱歉,当前不支持 https://github.com/gradle/gradle/第/1330期

I’m afraid, there is currently no support for JUnit RunListeners in Gradle. There is only an open ticket requesting that feature: https://github.com/gradle/gradle/issues/1330

由于某人在票证上的评论中提到了, 主要问题[…]是TestDescriptor.getAnnotations()的缺失";否则,您可能已经能够将您的RunListener重写为Gradle TestListener.因此,除非我在浏览机票时错过了一些东西,否则看来您现在似乎很不走运:-(

As someone has mentioned in the comments on that ticket, "the primary issue […] is the absence of TestDescriptor.getAnnotations()" in Gradle; otherwise you might have been able to rewrite your RunListener as a Gradle TestListener. So unless I’ve missed something when skimming through the ticket, it seems that you are mostly out of luck at the moment :-(

这篇关于Gradle中的JUnit侦听器配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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