Ray*_*yCh 5 gherkin robotframework
是否必须执行一些配置设置才能让 Robot Framework (RF) 运行 Gherkin/BDD 风格的测试用例?
我已经在 Windows 7 上安装了 RF 2.8.3,并且在 Selenium2Library 和 DatabaseLibrary 上运行正常。根据用户文档和网络上的其他信息,我应该能够编写和运行 Gherkin 风格的测试。但是,当我这样做时,我会出错。在尝试匹配关键字之前,RF 不会去除 Gherkin 关键字(Given、When、Then、...):
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.
------------------------------------------------------------------------------
Run Code Online (Sandbox Code Playgroud)
我使用直截了当的方式运行测试:
pybot ../Tests
Run Code Online (Sandbox Code Playgroud)
我的示例测试文件是:
*** 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.
Run Code Online (Sandbox Code Playgroud)
帮助将不胜感激。谢谢。
当搜索匹配的关键字时,前缀 Given、When、Then 和 And 将被删除
所以page does not contain a no template operation selected error message关键字需要重命名为But page does not contain a no template operation selected error message.
| 归档时间: |
|
| 查看次数: |
19769 次 |
| 最近记录: |