【问题标题】:RIDE - some Library/Resource are REDRIDE - 一些图书馆/资源是红色的
【发布时间】:2017-11-22 18:35:37
【问题描述】:

我的机器人框架脚本中的一些库/资源是红色的,如下所示: bad script with red marks

而另一个(我从中复制的)看起来不错: good script

我的工作环境(树)如下所示: working environment/tree

我不明白为什么在一个脚本中一切看起来都很好,而在另一个脚本(看起来几乎相同)中,一些库/资源是 RED。

我问的主要原因是我的python脚本(stability_tests.py)没有得到我发送的参数(stability_args,见下文)。

my robot framework script

*** Settings ***
Force Tags        Critical    template    Conf=3    isTor=0    isSanity=0    

headless    rcmd
Library           BeAm.beacon.tests.BeaconTesting    WITH NAME    
BeaconTesting
Library           Collections
Library           BeAm.beacon.stability_tests
Library           BeAm.beacon.tests
Resource          ../../BeAm/beacon/settings.txt
Resource          ../../BeAm/settings.txt
Resource          ../../BeAm/local_settings.txt

*** Test Cases ***
Create Test Object
    [Tags]    must
    ${TEST} =    BeaconTesting.Get Beacon Test    3
    Set Suite Variable    ${TEST}    ${TEST}

Prepare Beacon Server
    [Tags]    prpr
    BeaconTesting.Change Mss Value    ${None}
    BeaconTesting.Prepare Server    ${TEST}

Beacon Stability
    [Tags]    stability
    ${stability_args} =    Create Dictionary
    Set To Dictionary    ${stability_args}    RANDOM_BEACON_TYPES    False
    Set To Dictionary    ${stability_args}    TIME_GAP    0.3
    Set To Dictionary    ${stability_args}    STRESS_TEST_NUM_OF_REQ    20
    Set To Dictionary    ${stability_args}    WORKERS    2
    stability workers    ${TEST}    &{stability_args}

顺便说一句,python 脚本包含 stable_workers 函数。

def stability_workers(RANDOM_BEACON_TYPES=True, TIME_GAP=60, STRESS_TEST_NUM_OF_REQ=100000, WORKERS=25):
    s = NewStressTest(RANDOM_BEACON_TYPES, float(TIME_GAP), int(WORKERS), int(STRESS_TEST_NUM_OF_REQ)])

【问题讨论】:

    标签: python robotframework


    【解决方案1】:

    你可以试试下面的方法

    1)在环境变量中给出绝对路径直到BeAm.beacon

    2) 如果1不成功,创建一个环境变量PYTHONPATH并提供绝对路径直到BeAm.beacon

    这应该可以解决您的问题

    【讨论】:

    • 赞成票和关闭答案肯定会有所帮助..Thnks
    • 谢谢 Pankaj。我忘记提到的一件事是我使用 PyCharm 进行调查/开发,并且由于某种原因,当我不使用 PyCharm 时,我上面提到的问题不会发生,这意味着我确实从 Robot Framework 脚本中获得了“stability_args”到我的Python 脚本。
    • 我无法对此发表评论,因为我从未使用过 pycharm
    • 您还可以从 RIDE>Tools>Preferences 添加到 PYTHONPATH 的路径。
    猜你喜欢
    • 2014-05-16
    • 1970-01-01
    • 2020-03-04
    • 1970-01-01
    • 2015-02-03
    • 1970-01-01
    • 2021-11-23
    • 2015-09-04
    • 1970-01-01
    相关资源
    最近更新 更多