Robot Framework - 未找到关键字 - 使用 IP 地址作为 TARGET

Robot Framework - No keyword found - using IP address as TARGET

我收到 'No keyword with name....' 错误,如下所示。我认为这与我的测试用例引用 IP 地址有关但不确定?

查看下面我的测试代码和 CLI 输出,感谢帮助

*** Settings ***
Documentation   Suite - Open Connections and do a simple comparison test
Suite Setup     Device Open Connection      @{TARGET}
Suite Teardown  Device Close Connection     @{TARGET}
Library         OperatingSystem
Library         /Users/xxx/Desktop/CI/RobotTestingFramework/Libraries/pybot_jrouter.py    target=${TARGET}    WITH NAME    ${TARGET}
Library         /Users/xxx/Desktop/CI/RobotTestingFramework/Libraries/iplib.py
Resource        /Users/xxx/Desktop/CI/RobotTestingFramework/Resources/device_resources.robot
Resource        /Users/xxx/Desktop/CI/RobotTestingFramework/Resources/version_resources.robot

*** Variables ***
${USERNAME}    xxx
${PASSWORD}    Juniper123
${path}    ./Report
@{TARGET}    192.168.1.100
${OSversion}    12.1R1.9

*** Test Case ***
Check Software Version
    [Documentation]    Test - Version Check
    [Tags]    version
    FOR    ${target}    IN    @{TARGET}
    Check Software Version    ${target}    ${OSversion}
    END

检查版本软件 -

*** Settings ***
Resource    /Users/xxx/Desktop/CI/RobotTestingFramework/Resources/device_resources.robot
Library     String
Library     Collections
Library     XML

*** Keywords ***
Check Software Version
    [ARGUMENTS]    ${device}    ${software-version}
    ${get-software-details}    Command Executor    ${device}    show version    xml    //junos-version
    Should Be Equal    ${software-version}    ${get-software-details}    The Junos OS version is different than expected!

打开连接 -

*** Settings ***
Documentation   A resource file with reusable keywords for 'executing the command in device',initiate device connection and tear down device connection.It can be used for any devices such as  SWITCH,ROUTER,FIREWALL.     NOTE: It has to be developed further to make it complete generic


*** Keywords ***

Device Open Connection
    [Arguments]    @{devices}
    FOR    ${device}    IN    @{devices}
    Run Keyword    ${device}.Open Connection
    END






Check Version :: Suite - Open Connections and do a simple comparison test     
==============================================================================
Check Software Version :: Test - Version Check                        | FAIL |
Parent suite setup failed:
No keyword with name '192.168.1.100.Open Connection' found.

免责声明:我可以告诉您为什么它会抛出错误,但是您可以自行更改它以确保它已修复 - 很难推断 w/o 了解最终目标、库等的意图。

错误状态:

Parent suite setup failed:
No keyword with name '192.168.1.100.Open Connection' found.

您的套件设置(错误来源)是 Device Open Connection @{TARGET},例如使用参数调用关键字列表“TARGET”的成员(例如扩展列表)。该关键字正在对传递给它的所有参数进行循环,并且:

Run Keyword    ${device}.Open Connection

,其中“设备”是当前循环的值。
内置 Run Keyword 就是这样做的 - 它需要一个关键字名称并将执行它。所以你实际上是在传递“192.168.1.100.Open Connection”,并期待 - 什么? :) 执行此类关键字的框架?但是您还没有定义它,并且 - 它因该消息而失败。

这是我(至少)无法提供进一步帮助的时刻 - 这就是您看到 错误消息的原因,但从这里获取它的位置 - :)。
也许,这些库中某处有一个 method/keyword“打开连接”,需要 IP 地址;我不知道,我只是从这里开始猜测。