功能中的 Cucumber HTML 标签
我有一个黄瓜场景,我想测试 HTML 标签。
Scenario: enter words
Given I enter "cat,dog"
When I set tag to "li" and the class to "word"
Then I should see "<li class=\"word\">cat</li>"
And I should see "<li class=\"word\">dog</li>"
这是编写这个场景的正确方法吗?
I have a cucumber scenario where I wan to test for an HTML tag.
Scenario: enter words
Given I enter "cat,dog"
When I set tag to "li" and the class to "word"
Then I should see "<li class=\"word\">cat</li>"
And I should see "<li class=\"word\">dog</li>"
Is this the correct way to write this scenario?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该以简单的英语阅读您的场景。如果我不是开发人员,那么这个场景对我来说就没多大意义。你可以这样做:
步骤是:
黄瓜生成器应该已经提供了 with_scope 方法,但无论如何都是这样:
并且只需确保将选择器添加到 features/support/selectors 中的 selectors.rb 中定位器的案例说明:
You should aim to have your scenario's read in plain english. If I weren't a developer then the scenario wouldn't make much sense to me. You could do something like this:
The step for this would be:
The cucumber generator should already provide the with_scope method but here it is anyways:
And just be sure to add the selector to your selectors.rb in features/support/selectors inside the case statement for locator: