【发布时间】:2018-01-17 03:05:17
【问题描述】:
早上好,
我在 RobotFramework 文档中看到可以直接在 python 中创建关键字 (http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#creating-user-keywords)
例如 do_nothing 函数。
def hello(name):
print "Hello, %s!" % name
def do_nothing():
pass
它工作得很好,但问题是它必须添加到变量 PYTHONPASS 中,或者包含该文件的目录中。
问题是测试可以在多台计算机上执行,这意味着应该在每台运行测试的计算机上修改 this 变量。
第二点,不幸的是我的文件会在几个目录中使用。
例如:
A
A/B
A/B/C <== use here
A/B/D
A/B/E <== use here
...
还有一个..
是否可以直接在A级添加功能例如只添加一次?
或者是否可以在A目录级别的RobotFramework的关键字部分中添加一次,然后在C和E机器人文件中直接引用它:
A/lib.robot:
*** Keywords ***
def hello(name):
print "Hello, %s!" % name
def do_nothing():
pass
C and E:
*** Settings ***
Resource ../../A/lib.robot
【问题讨论】:
标签: robotframework