簡體   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