机器人框架工作::小黄瓜执行错误

时间:2018-02-05 16:25:55

标签: robotframework gherkin

我在运行相同的时候写了我的第一个小黄瓜脚本(first.robot)我得到了"No keyword with name 'Given' found."错误。是否有任何图书馆我必须包括或者我应该做任何pip安装吗?

***
Gherkin Style TC
   [Documentation]  Let me try this time
    Given  Environement Setup Ready
    When  Required URL Get Loaded
    Then  Wait For Meters List to Appear
    And  Capture the list of Meters
    Then  CloseBrowser

***

1 个答案:

答案 0 :(得分:2)

Given(和其他人)之后有两个空格,但机器人使用两个空格将关键字与参数分开。您必须在GivenWhen等之后只有一个空格,否则机器人会认为Given是关键字。

Gherkin Style TC
     [Documentation]  Let me try this time
     Given Environement Setup Ready
     When Required URL Get Loaded
     Then Wait For Meters List to Appear
     And Capture the list of Meters
     Then CloseBrowser

有些人在给定/之前添加额外的空间/然后使事情顺利排列:

Gherkin Style TC
     [Documentation]  Let me try this time
     Given Environement Setup Ready
      When Required URL Get Loaded
      Then Wait For Meters List to Appear
       And Capture the list of Meters
      Then CloseBrowser