Java cucumber jvm:截取特性顶部的注释
我正在使用cumberjvm(Groovy),我想知道是否有可能在特性之上截取一个定制的注释。例:Java cucumber jvm:截取特性顶部的注释,java,groovy,cucumber-jvm,Java,Groovy,Cucumber Jvm,我正在使用cumberjvm(Groovy),我想知道是否有可能在特性之上截取一个定制的注释。例: @MyAnnotation Feature: Something here //and somewhere a method like this: def doSomethingForMyAnnotation() {...} 如果不可能,如果在运行特定功能之前有其他方法来运行某些代码(在这之前没有@,这与场景有关)。当然,您可以在Groovy代码中引用任何自定义注释,如下所示: @Before
@MyAnnotation
Feature: Something here
//and somewhere a method like this:
def doSomethingForMyAnnotation() {...}
如果不可能,如果在运行特定功能之前有其他方法来运行某些代码(在这之前没有@,这与场景有关)。当然,您可以在Groovy代码中引用任何自定义注释,如下所示:
@Before("@MyAnnotation")
public void beforeMyAnnotation() {
// Do something
}
@After("@MyAnnotation")
public void afterMyAnnotation() {
// Do something
}
顺便说一句,这些都是标记的钩子,你也可以使用多个。请看一个简单的例子