Robotframework 如何在Robot框架中运行小黄瓜风格的测试用例
为了让Robot Framework(RF)运行Gherkin/BDD风格的测试用例,我必须执行一些配置设置吗 我已经在Windows 7上安装了RF 2.8.3,并且使用Selenium2库和DatabaseLibrary运行正常。根据网上的用户文档和其他信息,我应该能够编写和运行小黄瓜风格的测试。但是,当我这样做时,我会出错。在尝试匹配关键字之前,RF不会去除小黄瓜关键字(给定、何时、然后……):Robotframework 如何在Robot框架中运行小黄瓜风格的测试用例,robotframework,gherkin,Robotframework,Gherkin,为了让Robot Framework(RF)运行Gherkin/BDD风格的测试用例,我必须执行一些配置设置吗 我已经在Windows 7上安装了RF 2.8.3,并且使用Selenium2库和DatabaseLibrary运行正常。根据网上的用户文档和其他信息,我应该能够编写和运行小黄瓜风格的测试。但是,当我这样做时,我会出错。在尝试匹配关键字之前,RF不会去除小黄瓜关键字(给定、何时、然后……): Tests.Group001 GeneralTests ===================
Tests.Group001 GeneralTests
==============================================================================
Scenario: No template operation selected | FAIL |
No keyword with name 'But page does not contain a no template operation selected error message' found.
------------------------------------------------------------------------------
我使用直接的方法运行测试:
pybot ../Tests
我的示例测试文件是:
*** settings ***
Library Selenium2Library
Library DatabaseLibrary
Library kw_common
*** Test Cases ***
Scenario: No template operation selected
Given I have logged in and I have selected to perform template configuration
When I do not select a template operation
But page does not contain a no template operation selected error message
And I press the next button
Then I should not see a template operation selected error message
*** Keywords ***
I have logged in and I have selected to perform template configuration
Log Given I have logged in and I have selected to perform template configuration
I do not select a template operation
Log No template operation selected
page does not contain a no template operation selected error message
Page Should Not Contain 'ddTemplateOperation' is required.
I press the next button
Click Element xpath=//input[contains(@id,'next')]
I should not see a template operation selected error message
Page Should Contain 'ddTemplateOperation' is required.
非常感谢您的帮助。谢谢。来自官方文档: 匹配关键字时,将删除给定的前缀When、Then和 被搜查
因此,
页面不包含未选择模板操作的错误消息
关键字需要重命名为,但页面不包含未选择模板操作的错误消息
非常感谢您的参考,Harri。我现在明白问题所在了。视频显示,但
可以用作小黄瓜关键词,在尝试关键词匹配之前(可选)丢弃该关键词,但事实并非如此,并导致了失败。再次感谢。如果有人像我一样偶然发现了这条线索,请注意,如果您按照Harri答案中的链接进行操作,但是
关键字现在也会被删除:>如果没有找到与全名匹配的关键字,搜索匹配关键字时会删除给定的前缀、When、Then和But。