[英]Write jBehave example step
I want to write a jBehave step as follows; 我要编写一个jBehave步骤,如下所示;
@When("I perform <someAction> on $panel")
So I can have steps like 所以我可以采取类似
i. When I perform Action1 on Panel1
ii. When I perform Action2 on Panel2
Now as you can see, this step has a mix of placeholder 现在您可以看到,此步骤包含占位符
1. someAction which actually comes via meta
2. $panel which is taken from the step text in the story
But this is not working from me and I get NullPointerException 但这对我不起作用,并且我得到NullPointerException
It works if I write 如果我写就行
@When("I perform <someAction> on Panel1")
ie I cannot use the 2 placeholders in the same step. 即我不能在同一步骤中使用2个占位符。
But since this is a generic step, I do not want to hard code any values. 但是,由于这是通用步骤,因此我不想对任何值进行硬编码。
Yes you can 是的你可以
@When("I perform <someAction> on *panel*")
public void perform(@Named("panel") String panelId){
}
and from now, I recommend to identify all elements by name, using jemmy you can use a new NameComponentChooser(panelId)
从现在开始,我建议按名称标识所有元素,使用jemmy,您可以使用new NameComponentChooser(panelId)
Please use $symbol before both your parameters. 请在两个参数前都使用$ symbol。 Then both the example parameter as well as the normal parameter will be handled. 然后,将同时处理示例参数和常规参数。
@When("I perform $action on $panel")
public void performAction(String action, String panel){
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.