繁体   English   中英

cucumber-jvm:截取特征顶部的注释

[英]cucumber-jvm: intercepting annotations on top of feature

我正在使用Cucumber-JVM(Groovy),我想知道是否有可能在功能上拦截自定义注释。 例如:

@MyAnnotation
Feature: Something here

//and somewhere a method like this:
def doSomethingForMyAnnotation() {...}

如果不可能,在运行特定功能之前是否有替代方法可以运行某些代码(没有相对于Scenario的@Before)。

当然,您可以在Groovy代码中引用这样的任何自定义注释:

@Before("@MyAnnotation")
public void beforeMyAnnotation() {
    // Do something
}

@After("@MyAnnotation")
public void afterMyAnnotation() {
    // Do something
}

那些是标签挂钩BTW,你也可以使用多个。 在这里看一个快速的例子。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM