2017-10-13 231 views

回答

0

是的,它是可能的,你只需要标记您的功能首先命名,然后为该标记创建一个特定的Before和After钩子。经过this link

说..你有文件1

@tag 
Feature : check login functionality. 
... 

和您的特性文件2

@tag 
Feature : check login functionality. 
... 

那么你可以如下定义功能标签的具体挂钩:

@Before("@tag") 
    public void beforeFirst(){ 
     System.out.println("Running current feature"); 
    } 

@After("@tag") 
    public void afterFirst(){ 
     System.out.println("Ending current feature"); 
    }