简体   繁体   English

jBehave编写通用步骤

[英]jBehave write common step

Can I have the following step method using jBehave; 我可以使用jBehave获得以下步骤方法吗?

@When("I select action <actionText> on <panelTitle>")
@Alias("I select action $actionText on $panelTitle")
public void myMethod(@Named("actionText") String actionText, @Named("panelTitle") String panelTitle) {
    // My code
}

So as you can see, the step text is the same. 如您所见,步骤文本是相同的。 Only thing is in one case, the value is through parameter injection and in other it is through parameterised scenarios 唯一的情况是,在一种情况下,该值是通过参数注入来实现的,而在其他情况下,则是通过参数化方案来实现的

I have seen similar implementation in link: http://jbehave.org/reference/stable/parametrised-scenarios.html 我在链接中看到了类似的实现: http : //jbehave.org/reference/stable/parametrised-scenarios.html

So, you can use this method. 因此,您可以使用此方法。

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

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