2015-08-09 51 views
1

对于同一个函数,有多种方法可以有多个步骤定义(同一个类型)吗?类似于:在Cucumber JVM中为同一个函数定义几个步骤

@Then("^it's do something$") 
@Then("^it's do another thing$") 
public void this_is_my_function() throws Throwable { 
    // Do something 
} 

我现在在Behat(PHP)和Specflow(C#)中有可能。

,我发现了以下错误:

Error:(86, 5) java: cucumber.api.java.en.Then is not a repeatable annotation type 

我发现了一个post谈论重复的问题,但下面的解决方案没有奏效。

@Thens({ 
    @Then("^it's do something$") 
    @Then("^it's do another thing$") 
}) 

我想我应该定义@Thens作为一种新的注释类型,但我想只有在什么库必须依赖新生。没有其他解决方法吗?

回答

0

您可以将其合并成一个@Then:

@Then("^(?:it's do something|it's do another thing)$") 
public void this_is_my_function() throws Throwable { 
    // Do something 
} 
相关问题