是否可以在 Cucumber 中指定某种OR"(替代)子句?
Is it possible to specify some kind of "OR" (alternative) clause in Cucumber?
即如果我对某个事件有两个有效响应,我希望我的测试在其中任何一个发生时通过.
I.e. if I have two valid responses to some event I would like my test to pass if either of them happens.
类似的东西:
"When I press a button"
"Then I should see the text 'Boo'"
"Or I should see the text 'Foo'"
我的特定场景是登录屏幕.当我尝试使用一些随机密码登录时,如果服务器正在运行,我应该会看到错误消息密码无效",否则会看到消息网络错误".
My particular scenario is a login screen. When I try to log in with some random password, I should see an error message "invalid password" if the server is working or a message "network error" if it is not.
不支持OR.您可以使用 Given、When、Then、And 和 But.请参考 http://docs.behat.org/en/v2.5/guides/1.gherkin.html
OR is not supported. You can use Given, When, Then, And and But. Please refer to http://docs.behat.org/en/v2.5/guides/1.gherkin.html
但也许您可以使用 But 关键字来实现您正在寻找的东西.
But perhaps you could make use of the But keyword to achieve what you are looking for.
上一篇:Cucumber:未定义的步骤,虽然步骤应该被定义步骤、定义、未定义、Cucumber
下一篇:cucumber、rspec 和 rails 3 引发错误选项:--profile选项、错误、rspec、cucumber